| /* |
| * |
| * Copyright (c) 2022 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. |
| */ |
| |
| #import <Foundation/Foundation.h> |
| |
| #import "MTRAsyncCallbackWorkQueue.h" |
| #import "MTRBaseDevice_internal.h" |
| #import "MTRCallbackBridge_internal.h" |
| #import "MTRClusterConstants.h" |
| #import "MTRCluster_internal.h" |
| #import "MTRClusters_internal.h" |
| #import "MTRCommandPayloadsObjc.h" |
| #import "MTRDevice.h" |
| #import "MTRDevice_Internal.h" |
| #import "MTRStructsObjc.h" |
| |
| #include <lib/support/CHIPListUtils.h> |
| #include <platform/CHIPDeviceLayer.h> |
| #include <type_traits> |
| |
| using chip::Callback::Callback; |
| using chip::Callback::Cancelable; |
| using namespace chip::app::Clusters; |
| using chip::Messaging::ExchangeManager; |
| using chip::SessionHandle; |
| |
| // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. |
| @implementation MTRClusterIdentify |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)identifyWithParams:(MTRIdentifyClusterIdentifyParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Identify::Commands::Identify::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.identifyTime = params.identifyTime.unsignedShortValue; |
| |
| chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)triggerEffectWithParams:(MTRIdentifyClusterTriggerEffectParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Identify::Commands::TriggerEffect::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.effectIdentifier = static_cast<std::remove_reference_t<decltype(request.effectIdentifier)>>( |
| params.effectIdentifier.unsignedCharValue); |
| request.effectVariant |
| = static_cast<std::remove_reference_t<decltype(request.effectVariant)>>(params.effectVariant.unsignedCharValue); |
| |
| chip::Controller::IdentifyCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeIdentifyTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeIdentifyTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeIdentifyTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeIdentifyTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeIdentifyTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeIdentifyTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeIdentifyTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeIdentifyTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIdentifyID) |
| attributeID:@(MTRAttributeIDTypeClusterIdentifyAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterIdentify (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)identifyWithParams:(MTRIdentifyClusterIdentifyParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self identifyWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)triggerEffectWithParams:(MTRIdentifyClusterTriggerEffectParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self triggerEffectWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterGroups |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)addGroupWithParams:(MTRGroupsClusterAddGroupParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRGroupsClusterAddGroupResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGroupsClusterAddGroupResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, GroupsClusterAddGroupResponseCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Groups::Commands::AddGroup::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.groupName = [self asCharSpan:params.groupName]; |
| |
| chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)viewGroupWithParams:(MTRGroupsClusterViewGroupParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRGroupsClusterViewGroupResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGroupsClusterViewGroupResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GroupsClusterViewGroupResponseCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Groups::Commands::ViewGroup::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| |
| chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getGroupMembershipWithParams:(MTRGroupsClusterGetGroupMembershipParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGroupsClusterGetGroupMembershipResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GroupsClusterGetGroupMembershipResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Groups::Commands::GetGroupMembership::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.groupList)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.groupList.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.groupList.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.groupList.count; ++i_0) { |
| if (![params.groupList[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.groupList[i_0]; |
| listHolder_0->mList[i_0] = element_0.unsignedShortValue; |
| } |
| request.groupList = ListType_0(listHolder_0->mList, params.groupList.count); |
| } else { |
| request.groupList = ListType_0(); |
| } |
| } |
| |
| chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)removeGroupWithParams:(MTRGroupsClusterRemoveGroupParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRGroupsClusterRemoveGroupResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGroupsClusterRemoveGroupResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GroupsClusterRemoveGroupResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Groups::Commands::RemoveGroup::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| |
| chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)removeAllGroupsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self removeAllGroupsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)removeAllGroupsWithParams:(MTRGroupsClusterRemoveAllGroupsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Groups::Commands::RemoveAllGroups::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)addGroupIfIdentifyingWithParams:(MTRGroupsClusterAddGroupIfIdentifyingParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Groups::Commands::AddGroupIfIdentifying::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.groupName = [self asCharSpan:params.groupName]; |
| |
| chip::Controller::GroupsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNameSupportWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupsID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupsAttributeNameSupportID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupsID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupsID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupsID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupsID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupsID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterGroups (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)addGroupWithParams:(MTRGroupsClusterAddGroupParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRGroupsClusterAddGroupResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self addGroupWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGroupsClusterAddGroupResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRGroupsClusterAddGroupResponseParams *>(data), error); |
| }]; |
| } |
| - (void)viewGroupWithParams:(MTRGroupsClusterViewGroupParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRGroupsClusterViewGroupResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self viewGroupWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGroupsClusterViewGroupResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRGroupsClusterViewGroupResponseParams *>(data), error); |
| }]; |
| } |
| - (void)getGroupMembershipWithParams:(MTRGroupsClusterGetGroupMembershipParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getGroupMembershipWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRGroupsClusterGetGroupMembershipResponseParams *>(data), error); |
| }]; |
| } |
| - (void)removeGroupWithParams:(MTRGroupsClusterRemoveGroupParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRGroupsClusterRemoveGroupResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self removeGroupWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGroupsClusterRemoveGroupResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRGroupsClusterRemoveGroupResponseParams *>(data), error); |
| }]; |
| } |
| - (void)removeAllGroupsWithParams:(MTRGroupsClusterRemoveAllGroupsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self removeAllGroupsWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)removeAllGroupsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self removeAllGroupsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)addGroupIfIdentifyingWithParams:(MTRGroupsClusterAddGroupIfIdentifyingParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self addGroupIfIdentifyingWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterScenes |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)addSceneWithParams:(MTRScenesClusterAddSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRScenesClusterAddSceneResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterAddSceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, ScenesClusterAddSceneResponseCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::AddScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.sceneName = [self asCharSpan:params.sceneName]; |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.extensionFieldSets)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.extensionFieldSets.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.extensionFieldSets.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.extensionFieldSets.count; ++i_0) { |
| if (![params.extensionFieldSets[i_0] isKindOfClass:[MTRScenesClusterExtensionFieldSet class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRScenesClusterExtensionFieldSet *) params.extensionFieldSets[i_0]; |
| listHolder_0->mList[i_0].clusterId = element_0.clusterId.unsignedIntValue; |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].attributeValueList)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.attributeValueList.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.attributeValueList.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.attributeValueList.count; ++i_2) { |
| if (![element_0.attributeValueList[i_2] |
| isKindOfClass:[MTRScenesClusterAttributeValuePair class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2]; |
| if (element_2.attributeId != nil) { |
| auto & definedValue_4 = listHolder_2->mList[i_2].attributeId.Emplace(); |
| definedValue_4 = element_2.attributeId.unsignedIntValue; |
| } |
| { |
| using ListType_4 |
| = std::remove_reference_t<decltype(listHolder_2->mList[i_2].attributeValue)>; |
| using ListMemberType_4 = ListMemberTypeGetter<ListType_4>::Type; |
| if (element_2.attributeValue.count != 0) { |
| auto * listHolder_4 |
| = new ListHolder<ListMemberType_4>(element_2.attributeValue.count); |
| if (listHolder_4 == nullptr || listHolder_4->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_4); |
| for (size_t i_4 = 0; i_4 < element_2.attributeValue.count; ++i_4) { |
| if (![element_2.attributeValue[i_4] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_4 = (NSNumber *) element_2.attributeValue[i_4]; |
| listHolder_4->mList[i_4] = element_4.unsignedCharValue; |
| } |
| listHolder_2->mList[i_2].attributeValue |
| = ListType_4(listHolder_4->mList, element_2.attributeValue.count); |
| } else { |
| listHolder_2->mList[i_2].attributeValue = ListType_4(); |
| } |
| } |
| } |
| listHolder_0->mList[i_0].attributeValueList |
| = ListType_2(listHolder_2->mList, element_0.attributeValueList.count); |
| } else { |
| listHolder_0->mList[i_0].attributeValueList = ListType_2(); |
| } |
| } |
| } |
| request.extensionFieldSets = ListType_0(listHolder_0->mList, params.extensionFieldSets.count); |
| } else { |
| request.extensionFieldSets = ListType_0(); |
| } |
| } |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)viewSceneWithParams:(MTRScenesClusterViewSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRScenesClusterViewSceneResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterViewSceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterViewSceneResponseCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::ViewScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)removeSceneWithParams:(MTRScenesClusterRemoveSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRScenesClusterRemoveSceneResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterRemoveSceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterRemoveSceneResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::RemoveScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)removeAllScenesWithParams:(MTRScenesClusterRemoveAllScenesParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterRemoveAllScenesResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterRemoveAllScenesResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::RemoveAllScenes::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)storeSceneWithParams:(MTRScenesClusterStoreSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRScenesClusterStoreSceneResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterStoreSceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterStoreSceneResponseCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::StoreScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)recallSceneWithParams:(MTRScenesClusterRecallSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::RecallScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| if (params.transitionTime != nil) { |
| auto & definedValue_0 = request.transitionTime.Emplace(); |
| if (params.transitionTime == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| nonNullValue_1 = params.transitionTime.unsignedShortValue; |
| } |
| } |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getSceneMembershipWithParams:(MTRScenesClusterGetSceneMembershipParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterGetSceneMembershipResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterGetSceneMembershipResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::GetSceneMembership::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enhancedAddSceneWithParams:(MTRScenesClusterEnhancedAddSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterEnhancedAddSceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterEnhancedAddSceneResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::EnhancedAddScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.sceneName = [self asCharSpan:params.sceneName]; |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.extensionFieldSets)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.extensionFieldSets.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.extensionFieldSets.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.extensionFieldSets.count; ++i_0) { |
| if (![params.extensionFieldSets[i_0] isKindOfClass:[MTRScenesClusterExtensionFieldSet class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRScenesClusterExtensionFieldSet *) params.extensionFieldSets[i_0]; |
| listHolder_0->mList[i_0].clusterId = element_0.clusterId.unsignedIntValue; |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].attributeValueList)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.attributeValueList.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.attributeValueList.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.attributeValueList.count; ++i_2) { |
| if (![element_0.attributeValueList[i_2] |
| isKindOfClass:[MTRScenesClusterAttributeValuePair class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2]; |
| if (element_2.attributeId != nil) { |
| auto & definedValue_4 = listHolder_2->mList[i_2].attributeId.Emplace(); |
| definedValue_4 = element_2.attributeId.unsignedIntValue; |
| } |
| { |
| using ListType_4 |
| = std::remove_reference_t<decltype(listHolder_2->mList[i_2].attributeValue)>; |
| using ListMemberType_4 = ListMemberTypeGetter<ListType_4>::Type; |
| if (element_2.attributeValue.count != 0) { |
| auto * listHolder_4 |
| = new ListHolder<ListMemberType_4>(element_2.attributeValue.count); |
| if (listHolder_4 == nullptr || listHolder_4->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_4); |
| for (size_t i_4 = 0; i_4 < element_2.attributeValue.count; ++i_4) { |
| if (![element_2.attributeValue[i_4] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_4 = (NSNumber *) element_2.attributeValue[i_4]; |
| listHolder_4->mList[i_4] = element_4.unsignedCharValue; |
| } |
| listHolder_2->mList[i_2].attributeValue |
| = ListType_4(listHolder_4->mList, element_2.attributeValue.count); |
| } else { |
| listHolder_2->mList[i_2].attributeValue = ListType_4(); |
| } |
| } |
| } |
| listHolder_0->mList[i_0].attributeValueList |
| = ListType_2(listHolder_2->mList, element_0.attributeValueList.count); |
| } else { |
| listHolder_0->mList[i_0].attributeValueList = ListType_2(); |
| } |
| } |
| } |
| request.extensionFieldSets = ListType_0(listHolder_0->mList, params.extensionFieldSets.count); |
| } else { |
| request.extensionFieldSets = ListType_0(); |
| } |
| } |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enhancedViewSceneWithParams:(MTRScenesClusterEnhancedViewSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterEnhancedViewSceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterEnhancedViewSceneResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::EnhancedViewScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupId = params.groupId.unsignedShortValue; |
| request.sceneId = params.sceneId.unsignedCharValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)copySceneWithParams:(MTRScenesClusterCopySceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRScenesClusterCopySceneResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRScenesClusterCopySceneResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ScenesClusterCopySceneResponseCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Scenes::Commands::CopyScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.mode = static_cast<std::remove_reference_t<decltype(request.mode)>>(params.mode.unsignedCharValue); |
| request.groupIdFrom = params.groupIdFrom.unsignedShortValue; |
| request.sceneIdFrom = params.sceneIdFrom.unsignedCharValue; |
| request.groupIdTo = params.groupIdTo.unsignedShortValue; |
| request.sceneIdTo = params.sceneIdTo.unsignedCharValue; |
| |
| chip::Controller::ScenesCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSceneCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeSceneCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentSceneWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeCurrentSceneID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentGroupWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeCurrentGroupID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSceneValidWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeSceneValidID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNameSupportWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeNameSupportID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLastConfiguredByWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeLastConfiguredByID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeScenesID) |
| attributeID:@(MTRAttributeIDTypeClusterScenesAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterScenes (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)addSceneWithParams:(MTRScenesClusterAddSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRScenesClusterAddSceneResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self addSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterAddSceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterAddSceneResponseParams *>(data), error); |
| }]; |
| } |
| - (void)viewSceneWithParams:(MTRScenesClusterViewSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRScenesClusterViewSceneResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self viewSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterViewSceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterViewSceneResponseParams *>(data), error); |
| }]; |
| } |
| - (void)removeSceneWithParams:(MTRScenesClusterRemoveSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRScenesClusterRemoveSceneResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self removeSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterRemoveSceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterRemoveSceneResponseParams *>(data), error); |
| }]; |
| } |
| - (void)removeAllScenesWithParams:(MTRScenesClusterRemoveAllScenesParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self removeAllScenesWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterRemoveAllScenesResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterRemoveAllScenesResponseParams *>(data), error); |
| }]; |
| } |
| - (void)storeSceneWithParams:(MTRScenesClusterStoreSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRScenesClusterStoreSceneResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self storeSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterStoreSceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterStoreSceneResponseParams *>(data), error); |
| }]; |
| } |
| - (void)recallSceneWithParams:(MTRScenesClusterRecallSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self recallSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getSceneMembershipWithParams:(MTRScenesClusterGetSceneMembershipParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRScenesClusterGetSceneMembershipResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getSceneMembershipWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRScenesClusterGetSceneMembershipResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterGetSceneMembershipResponseParams *>(data), error); |
| }]; |
| } |
| - (void)enhancedAddSceneWithParams:(MTRScenesClusterEnhancedAddSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self enhancedAddSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterEnhancedAddSceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterEnhancedAddSceneResponseParams *>(data), error); |
| }]; |
| } |
| - (void)enhancedViewSceneWithParams:(MTRScenesClusterEnhancedViewSceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| enhancedViewSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterEnhancedViewSceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterEnhancedViewSceneResponseParams *>(data), error); |
| }]; |
| } |
| - (void)copySceneWithParams:(MTRScenesClusterCopySceneParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRScenesClusterCopySceneResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self copySceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRScenesClusterCopySceneResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRScenesClusterCopySceneResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterOnOff |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)offWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self offWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)offWithParams:(MTROnOffClusterOffParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OnOff::Commands::Off::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)onWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self onWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)onWithParams:(MTROnOffClusterOnParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OnOff::Commands::On::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)toggleWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self toggleWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)toggleWithParams:(MTROnOffClusterToggleParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OnOff::Commands::Toggle::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OnOff::Commands::OffWithEffect::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.effectId |
| = static_cast<std::remove_reference_t<decltype(request.effectId)>>(params.effectId.unsignedCharValue); |
| request.effectVariant |
| = static_cast<std::remove_reference_t<decltype(request.effectVariant)>>(params.effectVariant.unsignedCharValue); |
| |
| chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)onWithRecallGlobalSceneWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self onWithRecallGlobalSceneWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)onWithRecallGlobalSceneWithParams:(MTROnOffClusterOnWithRecallGlobalSceneParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OnOff::Commands::OnWithRecallGlobalScene::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)onWithTimedOffWithParams:(MTROnOffClusterOnWithTimedOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OnOff::Commands::OnWithTimedOff::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.onOffControl |
| = static_cast<std::remove_reference_t<decltype(request.onOffControl)>>(params.onOffControl.unsignedCharValue); |
| request.onTime = params.onTime.unsignedShortValue; |
| request.offWaitTime = params.offWaitTime.unsignedShortValue; |
| |
| chip::Controller::OnOffCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOnOffWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOnOffID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGlobalSceneControlWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeGlobalSceneControlID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOnTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOnTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOnTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOnTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOnTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOnTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOffWaitTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOffWaitTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOffWaitTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOffWaitTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOffWaitTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeOffWaitTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStartUpOnOffWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeStartUpOnOffID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeStartUpOnOffWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeStartUpOnOffWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeStartUpOnOffWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeStartUpOnOffID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOnOff (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)offWithParams:(MTROnOffClusterOffParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self offWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)offWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self offWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)onWithParams:(MTROnOffClusterOnParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self onWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)onWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self onWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)toggleWithParams:(MTROnOffClusterToggleParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self toggleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)toggleWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self toggleWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self offWithEffectWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)onWithRecallGlobalSceneWithParams:(MTROnOffClusterOnWithRecallGlobalSceneParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self onWithRecallGlobalSceneWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)onWithRecallGlobalSceneWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self onWithRecallGlobalSceneWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)onWithTimedOffWithParams:(MTROnOffClusterOnWithTimedOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self onWithTimedOffWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterOnOffSwitchConfiguration |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSwitchTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeSwitchTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSwitchActionsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeSwitchActionsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeSwitchActionsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeSwitchActionsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeSwitchActionsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeSwitchActionsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOnOffSwitchConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterOnOffSwitchConfigurationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOnOffSwitchConfiguration (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterLevelControl |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)moveToLevelWithParams:(MTRLevelControlClusterMoveToLevelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::MoveToLevel::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.level = params.level.unsignedCharValue; |
| if (params.transitionTime == nil) { |
| request.transitionTime.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.transitionTime.SetNonNull(); |
| nonNullValue_0 = params.transitionTime.unsignedShortValue; |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveWithParams:(MTRLevelControlClusterMoveParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::Move::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.moveMode |
| = static_cast<std::remove_reference_t<decltype(request.moveMode)>>(params.moveMode.unsignedCharValue); |
| if (params.rate == nil) { |
| request.rate.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.rate.SetNonNull(); |
| nonNullValue_0 = params.rate.unsignedCharValue; |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stepWithParams:(MTRLevelControlClusterStepParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::Step::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepMode |
| = static_cast<std::remove_reference_t<decltype(request.stepMode)>>(params.stepMode.unsignedCharValue); |
| request.stepSize = params.stepSize.unsignedCharValue; |
| if (params.transitionTime == nil) { |
| request.transitionTime.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.transitionTime.SetNonNull(); |
| nonNullValue_0 = params.transitionTime.unsignedShortValue; |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopWithParams:(MTRLevelControlClusterStopParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::Stop::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveToLevelWithOnOffWithParams:(MTRLevelControlClusterMoveToLevelWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::MoveToLevelWithOnOff::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.level = params.level.unsignedCharValue; |
| if (params.transitionTime == nil) { |
| request.transitionTime.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.transitionTime.SetNonNull(); |
| nonNullValue_0 = params.transitionTime.unsignedShortValue; |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveWithOnOffWithParams:(MTRLevelControlClusterMoveWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::MoveWithOnOff::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.moveMode |
| = static_cast<std::remove_reference_t<decltype(request.moveMode)>>(params.moveMode.unsignedCharValue); |
| if (params.rate == nil) { |
| request.rate.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.rate.SetNonNull(); |
| nonNullValue_0 = params.rate.unsignedCharValue; |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stepWithOnOffWithParams:(MTRLevelControlClusterStepWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::StepWithOnOff::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepMode |
| = static_cast<std::remove_reference_t<decltype(request.stepMode)>>(params.stepMode.unsignedCharValue); |
| request.stepSize = params.stepSize.unsignedCharValue; |
| if (params.transitionTime == nil) { |
| request.transitionTime.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.transitionTime.SetNonNull(); |
| nonNullValue_0 = params.transitionTime.unsignedShortValue; |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopWithOnOffWithParams:(MTRLevelControlClusterStopWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::StopWithOnOff::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.optionsMask |
| = static_cast<std::remove_reference_t<decltype(request.optionsMask)>>(params.optionsMask.unsignedCharValue); |
| request.optionsOverride = static_cast<std::remove_reference_t<decltype(request.optionsOverride)>>( |
| params.optionsOverride.unsignedCharValue); |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveToClosestFrequencyWithParams:(MTRLevelControlClusterMoveToClosestFrequencyParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LevelControl::Commands::MoveToClosestFrequency::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.frequency = params.frequency.unsignedShortValue; |
| |
| chip::Controller::LevelControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeCurrentLevelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRemainingTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeRemainingTimeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeMinLevelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeMaxLevelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentFrequencyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeCurrentFrequencyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinFrequencyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeMinFrequencyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxFrequencyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeMaxFrequencyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOptionsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOptionsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOptionsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOptionsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOptionsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOptionsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOnOffTransitionTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOnOffTransitionTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOnOffTransitionTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOnOffTransitionTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOnOffTransitionTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOnOffTransitionTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOnLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOnLevelID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOnLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOnLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOnLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOnLevelID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOnTransitionTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOnTransitionTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOnTransitionTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOnTransitionTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOnTransitionTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOnTransitionTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOffTransitionTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOffTransitionTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOffTransitionTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOffTransitionTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOffTransitionTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeOffTransitionTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDefaultMoveRateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeDefaultMoveRateID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeDefaultMoveRateWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeDefaultMoveRateWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeDefaultMoveRateWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeDefaultMoveRateID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStartUpCurrentLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeStartUpCurrentLevelID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeStartUpCurrentLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeStartUpCurrentLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeStartUpCurrentLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeStartUpCurrentLevelID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLevelControlID) |
| attributeID:@(MTRAttributeIDTypeClusterLevelControlAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterLevelControl (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)moveToLevelWithParams:(MTRLevelControlClusterMoveToLevelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToLevelWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveWithParams:(MTRLevelControlClusterMoveParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stepWithParams:(MTRLevelControlClusterStepParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stepWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stopWithParams:(MTRLevelControlClusterStopParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stopWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveToLevelWithOnOffWithParams:(MTRLevelControlClusterMoveToLevelWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToLevelWithOnOffWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveWithOnOffWithParams:(MTRLevelControlClusterMoveWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveWithOnOffWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stepWithOnOffWithParams:(MTRLevelControlClusterStepWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stepWithOnOffWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stopWithOnOffWithParams:(MTRLevelControlClusterStopWithOnOffParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stopWithOnOffWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveToClosestFrequencyWithParams:(MTRLevelControlClusterMoveToClosestFrequencyParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToClosestFrequencyWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterBinaryInputBasic |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveTextWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeActiveTextID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeActiveTextWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeActiveTextWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeActiveTextWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeActiveTextID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDescriptionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeDescriptionID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeDescriptionWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeDescriptionWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeDescriptionWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeDescriptionID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInactiveTextWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeInactiveTextID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInactiveTextWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInactiveTextWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInactiveTextWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeInactiveTextID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOutOfServiceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeOutOfServiceID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOutOfServiceWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOutOfServiceWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOutOfServiceWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeOutOfServiceID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePolarityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributePolarityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePresentValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributePresentValueID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePresentValueWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePresentValueWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributePresentValueWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributePresentValueID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReliabilityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeReliabilityID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeReliabilityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeReliabilityWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeReliabilityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeReliabilityID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStatusFlagsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeStatusFlagsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApplicationTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeApplicationTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBinaryInputBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBinaryInputBasicAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBinaryInputBasic (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterDescriptor |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDeviceListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeServerListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeServerListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClientListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeClientListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePartsListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributePartsListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDescriptorID) |
| attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterDescriptor (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBinding |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBindingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeBindingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBindingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBindingWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBindingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeBindingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBindingID) |
| attributeID:@(MTRAttributeIDTypeClusterBindingAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBinding (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAccessControl |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAclWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeAclID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeAclWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeAclWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeAclWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeAclID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeExtensionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeExtensionID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeExtensionWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeExtensionWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeExtensionWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeExtensionID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSubjectsPerAccessControlEntryWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeSubjectsPerAccessControlEntryID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTargetsPerAccessControlEntryWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeTargetsPerAccessControlEntryID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAccessControlEntriesPerFabricWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeAccessControlEntriesPerFabricID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccessControlID) |
| attributeID:@(MTRAttributeIDTypeClusterAccessControlAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAccessControl (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterActions |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)instantActionWithParams:(MTRActionsClusterInstantActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::InstantAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)instantActionWithTransitionWithParams:(MTRActionsClusterInstantActionWithTransitionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::InstantActionWithTransition::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)startActionWithParams:(MTRActionsClusterStartActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::StartAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)startActionWithDurationWithParams:(MTRActionsClusterStartActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::StartActionWithDuration::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| request.duration = params.duration.unsignedIntValue; |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopActionWithParams:(MTRActionsClusterStopActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::StopAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)pauseActionWithParams:(MTRActionsClusterPauseActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::PauseAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)pauseActionWithDurationWithParams:(MTRActionsClusterPauseActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::PauseActionWithDuration::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| request.duration = params.duration.unsignedIntValue; |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)resumeActionWithParams:(MTRActionsClusterResumeActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::ResumeAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enableActionWithParams:(MTRActionsClusterEnableActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::EnableAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enableActionWithDurationWithParams:(MTRActionsClusterEnableActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::EnableActionWithDuration::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| request.duration = params.duration.unsignedIntValue; |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)disableActionWithParams:(MTRActionsClusterDisableActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::DisableAction::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)disableActionWithDurationWithParams:(MTRActionsClusterDisableActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Actions::Commands::DisableActionWithDuration::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.actionID = params.actionID.unsignedShortValue; |
| if (params.invokeID != nil) { |
| auto & definedValue_0 = request.invokeID.Emplace(); |
| definedValue_0 = params.invokeID.unsignedIntValue; |
| } |
| request.duration = params.duration.unsignedIntValue; |
| |
| chip::Controller::ActionsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActionListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeActionListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEndpointListsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeEndpointListsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSetupURLWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeSetupURLID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeActionsID) |
| attributeID:@(MTRAttributeIDTypeClusterActionsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterActions (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)instantActionWithParams:(MTRActionsClusterInstantActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self instantActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)instantActionWithTransitionWithParams:(MTRActionsClusterInstantActionWithTransitionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self instantActionWithTransitionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)startActionWithParams:(MTRActionsClusterStartActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self startActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)startActionWithDurationWithParams:(MTRActionsClusterStartActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self startActionWithDurationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stopActionWithParams:(MTRActionsClusterStopActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stopActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)pauseActionWithParams:(MTRActionsClusterPauseActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self pauseActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)pauseActionWithDurationWithParams:(MTRActionsClusterPauseActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self pauseActionWithDurationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)resumeActionWithParams:(MTRActionsClusterResumeActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resumeActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)enableActionWithParams:(MTRActionsClusterEnableActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self enableActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)enableActionWithDurationWithParams:(MTRActionsClusterEnableActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self enableActionWithDurationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)disableActionWithParams:(MTRActionsClusterDisableActionParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self disableActionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)disableActionWithDurationWithParams:(MTRActionsClusterDisableActionWithDurationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self disableActionWithDurationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterBasic |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)mfgSpecificPingWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self mfgSpecificPingWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)mfgSpecificPingWithParams:(MTRBasicClusterMfgSpecificPingParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Basic::Commands::MfgSpecificPing::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::BasicCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDataModelRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeDataModelRevisionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeVendorNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeVendorIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeProductNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeProductIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNodeLabelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeNodeLabelID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNodeLabelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNodeLabelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNodeLabelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeNodeLabelID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLocationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeLocationID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLocationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLocationWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLocationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeLocationID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHardwareVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeHardwareVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHardwareVersionStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeHardwareVersionStringID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSoftwareVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeSoftwareVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSoftwareVersionStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeSoftwareVersionStringID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeManufacturingDateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeManufacturingDateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePartNumberWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributePartNumberID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductURLWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeProductURLID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductLabelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeProductLabelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSerialNumberWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeSerialNumberID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLocalConfigDisabledWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeLocalConfigDisabledID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLocalConfigDisabledWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLocalConfigDisabledWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLocalConfigDisabledWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeLocalConfigDisabledID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReachableWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeReachableID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUniqueIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeUniqueIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCapabilityMinimaWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeCapabilityMinimaID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBasicAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBasic (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)mfgSpecificPingWithParams:(MTRBasicClusterMfgSpecificPingParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self mfgSpecificPingWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)mfgSpecificPingWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self mfgSpecificPingWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterOtaSoftwareUpdateProvider |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)queryImageWithParams:(MTROtaSoftwareUpdateProviderClusterQueryImageParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROtaSoftwareUpdateProviderClusterQueryImageResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OtaSoftwareUpdateProviderClusterQueryImageResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OtaSoftwareUpdateProvider::Commands::QueryImage::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.vendorId |
| = static_cast<std::remove_reference_t<decltype(request.vendorId)>>(params.vendorId.unsignedShortValue); |
| request.productId = params.productId.unsignedShortValue; |
| request.softwareVersion = params.softwareVersion.unsignedIntValue; |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.protocolsSupported)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.protocolsSupported.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.protocolsSupported.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.protocolsSupported.count; ++i_0) { |
| if (![params.protocolsSupported[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.protocolsSupported[i_0]; |
| listHolder_0->mList[i_0] = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0])>>( |
| element_0.unsignedCharValue); |
| } |
| request.protocolsSupported = ListType_0(listHolder_0->mList, params.protocolsSupported.count); |
| } else { |
| request.protocolsSupported = ListType_0(); |
| } |
| } |
| if (params.hardwareVersion != nil) { |
| auto & definedValue_0 = request.hardwareVersion.Emplace(); |
| definedValue_0 = params.hardwareVersion.unsignedShortValue; |
| } |
| if (params.location != nil) { |
| auto & definedValue_0 = request.location.Emplace(); |
| definedValue_0 = [self asCharSpan:params.location]; |
| } |
| if (params.requestorCanConsent != nil) { |
| auto & definedValue_0 = request.requestorCanConsent.Emplace(); |
| definedValue_0 = params.requestorCanConsent.boolValue; |
| } |
| if (params.metadataForProvider != nil) { |
| auto & definedValue_0 = request.metadataForProvider.Emplace(); |
| definedValue_0 = [self asByteSpan:params.metadataForProvider]; |
| } |
| |
| chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)applyUpdateRequestWithParams:(MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OtaSoftwareUpdateProviderClusterApplyUpdateResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.updateToken = [self asByteSpan:params.updateToken]; |
| request.newVersion = params.newVersion.unsignedIntValue; |
| |
| chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)notifyUpdateAppliedWithParams:(MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.updateToken = [self asByteSpan:params.updateToken]; |
| request.softwareVersion = params.softwareVersion.unsignedIntValue; |
| |
| chip::Controller::OtaSoftwareUpdateProviderCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateProviderID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateProviderAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateProviderID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateProviderAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateProviderID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateProviderAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateProviderID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateProviderAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateProviderID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateProviderAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOtaSoftwareUpdateProvider (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)queryImageWithParams:(MTROtaSoftwareUpdateProviderClusterQueryImageParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self queryImageWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams *>(data), error); |
| }]; |
| } |
| - (void)applyUpdateRequestWithParams:(MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self applyUpdateRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams *>(data), error); |
| }]; |
| } |
| - (void)notifyUpdateAppliedWithParams:(MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self notifyUpdateAppliedWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterOtaSoftwareUpdateRequestor |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)announceOtaProviderWithParams:(MTROtaSoftwareUpdateRequestorClusterAnnounceOtaProviderParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OtaSoftwareUpdateRequestor::Commands::AnnounceOtaProvider::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.providerNodeId = params.providerNodeId.unsignedLongLongValue; |
| request.vendorId |
| = static_cast<std::remove_reference_t<decltype(request.vendorId)>>(params.vendorId.unsignedShortValue); |
| request.announcementReason = static_cast<std::remove_reference_t<decltype(request.announcementReason)>>( |
| params.announcementReason.unsignedCharValue); |
| if (params.metadataForNode != nil) { |
| auto & definedValue_0 = request.metadataForNode.Emplace(); |
| definedValue_0 = [self asByteSpan:params.metadataForNode]; |
| } |
| request.endpoint = params.endpoint.unsignedShortValue; |
| |
| chip::Controller::OtaSoftwareUpdateRequestorCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDefaultOtaProvidersWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeDefaultOtaProvidersID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeDefaultOtaProvidersWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeDefaultOtaProvidersWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeDefaultOtaProvidersWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeDefaultOtaProvidersID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUpdatePossibleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeUpdatePossibleID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUpdateStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeUpdateStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUpdateStateProgressWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeUpdateStateProgressID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOtaSoftwareUpdateRequestorID) |
| attributeID:@(MTRAttributeIDTypeClusterOtaSoftwareUpdateRequestorAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOtaSoftwareUpdateRequestor (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)announceOtaProviderWithParams:(MTROtaSoftwareUpdateRequestorClusterAnnounceOtaProviderParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self announceOtaProviderWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterLocalizationConfiguration |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveLocaleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeActiveLocaleID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeActiveLocaleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeActiveLocaleWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeActiveLocaleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeActiveLocaleID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportedLocalesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeSupportedLocalesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLocalizationConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterLocalizationConfigurationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterLocalizationConfiguration (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterTimeFormatLocalization |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHourFormatWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeHourFormatID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeHourFormatWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeHourFormatWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeHourFormatWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeHourFormatID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveCalendarTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeActiveCalendarTypeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeActiveCalendarTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeActiveCalendarTypeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeActiveCalendarTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeActiveCalendarTypeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportedCalendarTypesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeSupportedCalendarTypesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTimeFormatLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterTimeFormatLocalizationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterTimeFormatLocalization (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterUnitLocalization |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTemperatureUnitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeTemperatureUnitID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeTemperatureUnitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeTemperatureUnitWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeTemperatureUnitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeTemperatureUnitID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitLocalizationID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitLocalizationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterUnitLocalization (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPowerSourceConfiguration |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSourcesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeSourcesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceConfigurationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPowerSourceConfiguration (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPowerSource |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOrderWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeOrderID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDescriptionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeDescriptionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredAssessedInputVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredAssessedInputVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredAssessedInputFrequencyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredAssessedInputFrequencyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredCurrentTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredCurrentTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredAssessedCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredAssessedCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredNominalVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredNominalVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredMaximumCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredMaximumCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiredPresentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeWiredPresentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveWiredFaultsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeActiveWiredFaultsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatPercentRemainingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatPercentRemainingID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatTimeRemainingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatTimeRemainingID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatChargeLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatChargeLevelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatReplacementNeededWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatReplacementNeededID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatReplaceabilityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatReplaceabilityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatPresentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatPresentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveBatFaultsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeActiveBatFaultsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatReplacementDescriptionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatReplacementDescriptionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatCommonDesignationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatCommonDesignationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatANSIDesignationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatANSIDesignationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatIECDesignationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatIECDesignationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatApprovedChemistryWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatApprovedChemistryID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatCapacityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatCapacityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatQuantityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatQuantityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatChargeStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatChargeStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatTimeToFullChargeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatTimeToFullChargeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatFunctionalWhileChargingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatFunctionalWhileChargingID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBatChargingCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeBatChargingCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveBatChargeFaultsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeActiveBatChargeFaultsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePowerSourceID) |
| attributeID:@(MTRAttributeIDTypeClusterPowerSourceAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPowerSource (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterGeneralCommissioning |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)armFailSafeWithParams:(MTRGeneralCommissioningClusterArmFailSafeParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGeneralCommissioningClusterArmFailSafeResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GeneralCommissioningClusterArmFailSafeResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GeneralCommissioning::Commands::ArmFailSafe::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.expiryLengthSeconds = params.expiryLengthSeconds.unsignedShortValue; |
| request.breadcrumb = params.breadcrumb.unsignedLongLongValue; |
| |
| chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setRegulatoryConfigWithParams:(MTRGeneralCommissioningClusterSetRegulatoryConfigParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGeneralCommissioningClusterSetRegulatoryConfigResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GeneralCommissioningClusterSetRegulatoryConfigResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GeneralCommissioning::Commands::SetRegulatoryConfig::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.newRegulatoryConfig = static_cast<std::remove_reference_t<decltype(request.newRegulatoryConfig)>>( |
| params.newRegulatoryConfig.unsignedCharValue); |
| request.countryCode = [self asCharSpan:params.countryCode]; |
| request.breadcrumb = params.breadcrumb.unsignedLongLongValue; |
| |
| chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)commissioningCompleteWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)( |
| MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self commissioningCompleteWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)commissioningCompleteWithParams:(MTRGeneralCommissioningClusterCommissioningCompleteParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GeneralCommissioningClusterCommissioningCompleteResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GeneralCommissioning::Commands::CommissioningComplete::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::GeneralCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBreadcrumbWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeBreadcrumbID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBreadcrumbWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBreadcrumbWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBreadcrumbWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeBreadcrumbID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBasicCommissioningInfoWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeBasicCommissioningInfoID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRegulatoryConfigWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeRegulatoryConfigID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLocationCapabilityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeLocationCapabilityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportsConcurrentConnectionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeSupportsConcurrentConnectionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralCommissioningAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterGeneralCommissioning (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)armFailSafeWithParams:(MTRGeneralCommissioningClusterArmFailSafeParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self armFailSafeWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRGeneralCommissioningClusterArmFailSafeResponseParams *>(data), error); |
| }]; |
| } |
| - (void)setRegulatoryConfigWithParams:(MTRGeneralCommissioningClusterSetRegulatoryConfigParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self setRegulatoryConfigWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams *>(data), error); |
| }]; |
| } |
| - (void)commissioningCompleteWithParams:(MTRGeneralCommissioningClusterCommissioningCompleteParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| commissioningCompleteWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRGeneralCommissioningClusterCommissioningCompleteResponseParams *>(data), error); |
| }]; |
| } |
| - (void)commissioningCompleteWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self commissioningCompleteWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterNetworkCommissioning |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)scanNetworksWithParams:(MTRNetworkCommissioningClusterScanNetworksParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRNetworkCommissioningClusterScanNetworksResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| NetworkCommissioningClusterScanNetworksResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| NetworkCommissioning::Commands::ScanNetworks::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (params != nil) { |
| if (params.ssid != nil) { |
| auto & definedValue_0 = request.ssid.Emplace(); |
| if (params.ssid == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| nonNullValue_1 = [self asByteSpan:params.ssid]; |
| } |
| } |
| if (params.breadcrumb != nil) { |
| auto & definedValue_0 = request.breadcrumb.Emplace(); |
| definedValue_0 = params.breadcrumb.unsignedLongLongValue; |
| } |
| } |
| |
| chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)addOrUpdateWiFiNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| NetworkCommissioningClusterNetworkConfigResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.ssid = [self asByteSpan:params.ssid]; |
| request.credentials = [self asByteSpan:params.credentials]; |
| if (params.breadcrumb != nil) { |
| auto & definedValue_0 = request.breadcrumb.Emplace(); |
| definedValue_0 = params.breadcrumb.unsignedLongLongValue; |
| } |
| |
| chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)addOrUpdateThreadNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| NetworkCommissioningClusterNetworkConfigResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.operationalDataset = [self asByteSpan:params.operationalDataset]; |
| if (params.breadcrumb != nil) { |
| auto & definedValue_0 = request.breadcrumb.Emplace(); |
| definedValue_0 = params.breadcrumb.unsignedLongLongValue; |
| } |
| |
| chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)removeNetworkWithParams:(MTRNetworkCommissioningClusterRemoveNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| NetworkCommissioningClusterNetworkConfigResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| NetworkCommissioning::Commands::RemoveNetwork::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.networkID = [self asByteSpan:params.networkID]; |
| if (params.breadcrumb != nil) { |
| auto & definedValue_0 = request.breadcrumb.Emplace(); |
| definedValue_0 = params.breadcrumb.unsignedLongLongValue; |
| } |
| |
| chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)connectNetworkWithParams:(MTRNetworkCommissioningClusterConnectNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRNetworkCommissioningClusterConnectNetworkResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| NetworkCommissioningClusterConnectNetworkResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| NetworkCommissioning::Commands::ConnectNetwork::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.networkID = [self asByteSpan:params.networkID]; |
| if (params.breadcrumb != nil) { |
| auto & definedValue_0 = request.breadcrumb.Emplace(); |
| definedValue_0 = params.breadcrumb.unsignedLongLongValue; |
| } |
| |
| chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)reorderNetworkWithParams:(MTRNetworkCommissioningClusterReorderNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| NetworkCommissioningClusterNetworkConfigResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| NetworkCommissioning::Commands::ReorderNetwork::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.networkID = [self asByteSpan:params.networkID]; |
| request.networkIndex = params.networkIndex.unsignedCharValue; |
| if (params.breadcrumb != nil) { |
| auto & definedValue_0 = request.breadcrumb.Emplace(); |
| definedValue_0 = params.breadcrumb.unsignedLongLongValue; |
| } |
| |
| chip::Controller::NetworkCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxNetworksWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeMaxNetworksID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNetworksWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeNetworksID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeScanMaxTimeSecondsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeScanMaxTimeSecondsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeConnectMaxTimeSecondsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeConnectMaxTimeSecondsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInterfaceEnabledWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeInterfaceEnabledID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInterfaceEnabledWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInterfaceEnabledWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInterfaceEnabledWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeInterfaceEnabledID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLastNetworkingStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeLastNetworkingStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLastNetworkIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeLastNetworkIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLastConnectErrorValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeLastConnectErrorValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeNetworkCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterNetworkCommissioningAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterNetworkCommissioning (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)scanNetworksWithParams:(MTRNetworkCommissioningClusterScanNetworksParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self scanNetworksWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRNetworkCommissioningClusterScanNetworksResponseParams *>(data), error); |
| }]; |
| } |
| - (void)addOrUpdateWiFiNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self addOrUpdateWiFiNetworkWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRNetworkCommissioningClusterNetworkConfigResponseParams *>(data), error); |
| }]; |
| } |
| - (void)addOrUpdateThreadNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self addOrUpdateThreadNetworkWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRNetworkCommissioningClusterNetworkConfigResponseParams *>(data), error); |
| }]; |
| } |
| - (void)removeNetworkWithParams:(MTRNetworkCommissioningClusterRemoveNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self removeNetworkWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRNetworkCommissioningClusterNetworkConfigResponseParams *>(data), error); |
| }]; |
| } |
| - (void)connectNetworkWithParams:(MTRNetworkCommissioningClusterConnectNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| connectNetworkWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRNetworkCommissioningClusterConnectNetworkResponseParams *>(data), error); |
| }]; |
| } |
| - (void)reorderNetworkWithParams:(MTRNetworkCommissioningClusterReorderNetworkParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| reorderNetworkWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRNetworkCommissioningClusterNetworkConfigResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterDiagnosticLogs |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)retrieveLogsRequestWithParams:(MTRDiagnosticLogsClusterRetrieveLogsRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDiagnosticLogsClusterRetrieveLogsResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DiagnosticLogsClusterRetrieveLogsResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DiagnosticLogs::Commands::RetrieveLogsRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.intent = static_cast<std::remove_reference_t<decltype(request.intent)>>(params.intent.unsignedCharValue); |
| request.requestedProtocol = static_cast<std::remove_reference_t<decltype(request.requestedProtocol)>>( |
| params.requestedProtocol.unsignedCharValue); |
| request.transferFileDesignator = [self asByteSpan:params.transferFileDesignator]; |
| |
| chip::Controller::DiagnosticLogsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDiagnosticLogsID) |
| attributeID:@(MTRAttributeIDTypeClusterDiagnosticLogsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDiagnosticLogsID) |
| attributeID:@(MTRAttributeIDTypeClusterDiagnosticLogsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDiagnosticLogsID) |
| attributeID:@(MTRAttributeIDTypeClusterDiagnosticLogsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDiagnosticLogsID) |
| attributeID:@(MTRAttributeIDTypeClusterDiagnosticLogsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDiagnosticLogsID) |
| attributeID:@(MTRAttributeIDTypeClusterDiagnosticLogsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterDiagnosticLogs (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)retrieveLogsRequestWithParams:(MTRDiagnosticLogsClusterRetrieveLogsRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self retrieveLogsRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDiagnosticLogsClusterRetrieveLogsResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterGeneralDiagnostics |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)testEventTriggerWithParams:(MTRGeneralDiagnosticsClusterTestEventTriggerParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GeneralDiagnostics::Commands::TestEventTrigger::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.enableKey = [self asByteSpan:params.enableKey]; |
| request.eventTrigger = params.eventTrigger.unsignedLongLongValue; |
| |
| chip::Controller::GeneralDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNetworkInterfacesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeNetworkInterfacesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRebootCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeRebootCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUpTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeUpTimeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTotalOperationalHoursWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeTotalOperationalHoursID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBootReasonsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeBootReasonsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveHardwareFaultsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeActiveHardwareFaultsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveRadioFaultsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeActiveRadioFaultsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveNetworkFaultsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeActiveNetworkFaultsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTestEventTriggersEnabledWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeTestEventTriggersEnabledID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGeneralDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterGeneralDiagnosticsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterGeneralDiagnostics (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)testEventTriggerWithParams:(MTRGeneralDiagnosticsClusterTestEventTriggerParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testEventTriggerWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterSoftwareDiagnostics |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)resetWatermarksWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self resetWatermarksWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)resetWatermarksWithParams:(MTRSoftwareDiagnosticsClusterResetWatermarksParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| SoftwareDiagnostics::Commands::ResetWatermarks::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::SoftwareDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeThreadMetricsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeThreadMetricsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentHeapFreeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeCurrentHeapFreeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentHeapUsedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeCurrentHeapUsedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentHeapHighWatermarkWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeCurrentHeapHighWatermarkID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSoftwareDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterSoftwareDiagnosticsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterSoftwareDiagnostics (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)resetWatermarksWithParams:(MTRSoftwareDiagnosticsClusterResetWatermarksParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetWatermarksWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)resetWatermarksWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetWatermarksWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterThreadNetworkDiagnostics |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)resetCountsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self resetCountsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)resetCountsWithParams:(MTRThreadNetworkDiagnosticsClusterResetCountsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ThreadNetworkDiagnostics::Commands::ResetCounts::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::ThreadNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeChannelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeChannelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRoutingRoleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRoutingRoleID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNetworkNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeNetworkNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePanIdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributePanIdID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeExtendedPanIdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeExtendedPanIdID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeshLocalPrefixWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeMeshLocalPrefixID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOverrunCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeOverrunCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNeighborTableListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeNeighborTableListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRouteTableListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRouteTableListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePartitionIdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributePartitionIdID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWeightingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeWeightingID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDataVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeDataVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStableDataVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeStableDataVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLeaderRouterIdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeLeaderRouterIdID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDetachedRoleCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeDetachedRoleCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeChildRoleCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeChildRoleCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRouterRoleCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRouterRoleCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLeaderRoleCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeLeaderRoleCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttachAttemptCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeAttachAttemptCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePartitionIdChangeCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributePartitionIdChangeCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBetterPartitionAttachAttemptCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeBetterPartitionAttachAttemptCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeParentChangeCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeParentChangeCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxTotalCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxTotalCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxUnicastCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxUnicastCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxBroadcastCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxBroadcastCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxAckRequestedCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxAckRequestedCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxAckedCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxAckedCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxNoAckRequestedCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxNoAckRequestedCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxDataCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxDataCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxDataPollCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxDataPollCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxBeaconCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxBeaconCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxBeaconRequestCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxBeaconRequestCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxOtherCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxOtherCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxRetryCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxRetryCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxDirectMaxRetryExpiryCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxDirectMaxRetryExpiryCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxIndirectMaxRetryExpiryCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxIndirectMaxRetryExpiryCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxErrCcaCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxErrCcaCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxErrAbortCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxErrAbortCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxErrBusyChannelCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeTxErrBusyChannelCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxTotalCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxTotalCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxUnicastCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxUnicastCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxBroadcastCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxBroadcastCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxDataCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxDataCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxDataPollCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxDataPollCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxBeaconCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxBeaconCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxBeaconRequestCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxBeaconRequestCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxOtherCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxOtherCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxAddressFilteredCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxAddressFilteredCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxDestAddrFilteredCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxDestAddrFilteredCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxDuplicatedCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxDuplicatedCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxErrNoFrameCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxErrNoFrameCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxErrUnknownNeighborCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxErrUnknownNeighborCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxErrInvalidSrcAddrCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxErrInvalidSrcAddrCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxErrSecCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxErrSecCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxErrFcsCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxErrFcsCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRxErrOtherCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeRxErrOtherCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveTimestampWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeActiveTimestampID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePendingTimestampWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributePendingTimestampID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeDelayID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSecurityPolicyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeSecurityPolicyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeChannelPage0MaskWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeChannelPage0MaskID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOperationalDatasetComponentsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeOperationalDatasetComponentsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveNetworkFaultsListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeActiveNetworkFaultsListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThreadNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterThreadNetworkDiagnosticsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterThreadNetworkDiagnostics (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)resetCountsWithParams:(MTRThreadNetworkDiagnosticsClusterResetCountsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetCountsWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)resetCountsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetCountsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterWiFiNetworkDiagnostics |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)resetCountsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self resetCountsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)resetCountsWithParams:(MTRWiFiNetworkDiagnosticsClusterResetCountsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WiFiNetworkDiagnostics::Commands::ResetCounts::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::WiFiNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBssidWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeBssidID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSecurityTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeSecurityTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWiFiVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeWiFiVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeChannelNumberWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeChannelNumberID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRssiWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeRssiID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBeaconLostCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeBeaconLostCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBeaconRxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeBeaconRxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePacketMulticastRxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributePacketMulticastRxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePacketMulticastTxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributePacketMulticastTxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePacketUnicastRxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributePacketUnicastRxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePacketUnicastTxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributePacketUnicastTxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentMaxRateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeCurrentMaxRateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOverrunCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeOverrunCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWiFiNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterWiFiNetworkDiagnosticsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterWiFiNetworkDiagnostics (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)resetCountsWithParams:(MTRWiFiNetworkDiagnosticsClusterResetCountsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetCountsWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)resetCountsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetCountsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterEthernetNetworkDiagnostics |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)resetCountsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self resetCountsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)resetCountsWithParams:(MTREthernetNetworkDiagnosticsClusterResetCountsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| EthernetNetworkDiagnostics::Commands::ResetCounts::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::EthernetNetworkDiagnosticsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePHYRateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributePHYRateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFullDuplexWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeFullDuplexID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePacketRxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributePacketRxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePacketTxCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributePacketTxCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTxErrCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeTxErrCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCollisionCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeCollisionCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOverrunCountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeOverrunCountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCarrierDetectWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeCarrierDetectID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTimeSinceResetWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeTimeSinceResetID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeEthernetNetworkDiagnosticsID) |
| attributeID:@(MTRAttributeIDTypeClusterEthernetNetworkDiagnosticsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterEthernetNetworkDiagnostics (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)resetCountsWithParams:(MTREthernetNetworkDiagnosticsClusterResetCountsParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetCountsWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)resetCountsWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self resetCountsWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterBridgedDeviceBasic |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeVendorNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeVendorIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeProductNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNodeLabelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeNodeLabelID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNodeLabelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNodeLabelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNodeLabelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeNodeLabelID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHardwareVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeHardwareVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHardwareVersionStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeHardwareVersionStringID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSoftwareVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeSoftwareVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSoftwareVersionStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeSoftwareVersionStringID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeManufacturingDateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeManufacturingDateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePartNumberWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributePartNumberID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductURLWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeProductURLID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductLabelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeProductLabelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSerialNumberWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeSerialNumberID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReachableWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeReachableID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUniqueIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeUniqueIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBridgedDeviceBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterBridgedDeviceBasicAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBridgedDeviceBasic (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterSwitch |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfPositionsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeNumberOfPositionsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeCurrentPositionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMultiPressMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeMultiPressMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeSwitchID) |
| attributeID:@(MTRAttributeIDTypeClusterSwitchAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterSwitch (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAdministratorCommissioning |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)openCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterOpenCommissioningWindowParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AdministratorCommissioning::Commands::OpenCommissioningWindow::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.commissioningTimeout = params.commissioningTimeout.unsignedShortValue; |
| request.PAKEVerifier = [self asByteSpan:params.pakeVerifier]; |
| request.discriminator = params.discriminator.unsignedShortValue; |
| request.iterations = params.iterations.unsignedIntValue; |
| request.salt = [self asByteSpan:params.salt]; |
| |
| chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)openBasicCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.commissioningTimeout = params.commissioningTimeout.unsignedShortValue; |
| |
| chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)revokeCommissioningWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self revokeCommissioningWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)revokeCommissioningWithParams:(MTRAdministratorCommissioningClusterRevokeCommissioningParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AdministratorCommissioning::Commands::RevokeCommissioning::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| |
| chip::Controller::AdministratorCommissioningCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWindowStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeWindowStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAdminFabricIndexWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeAdminFabricIndexID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAdminVendorIdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeAdminVendorIdID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAdministratorCommissioningID) |
| attributeID:@(MTRAttributeIDTypeClusterAdministratorCommissioningAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAdministratorCommissioning (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)openCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterOpenCommissioningWindowParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self openCommissioningWindowWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)openBasicCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self openBasicCommissioningWindowWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)revokeCommissioningWithParams:(MTRAdministratorCommissioningClusterRevokeCommissioningParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self revokeCommissioningWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)revokeCommissioningWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self revokeCommissioningWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterOperationalCredentials |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)attestationRequestWithParams:(MTROperationalCredentialsClusterAttestationRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterAttestationResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterAttestationResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::AttestationRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.attestationNonce = [self asByteSpan:params.attestationNonce]; |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)certificateChainRequestWithParams:(MTROperationalCredentialsClusterCertificateChainRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterCertificateChainResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterCertificateChainResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::CertificateChainRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.certificateType = params.certificateType.unsignedCharValue; |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)CSRRequestWithParams:(MTROperationalCredentialsClusterCSRRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterCSRResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterCSRResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterCSRResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::CSRRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.CSRNonce = [self asByteSpan:params.csrNonce]; |
| if (params.isForUpdateNOC != nil) { |
| auto & definedValue_0 = request.isForUpdateNOC.Emplace(); |
| definedValue_0 = params.isForUpdateNOC.boolValue; |
| } |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)addNOCWithParams:(MTROperationalCredentialsClusterAddNOCParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterNOCResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterNOCResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::AddNOC::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.NOCValue = [self asByteSpan:params.nocValue]; |
| if (params.icacValue != nil) { |
| auto & definedValue_0 = request.ICACValue.Emplace(); |
| definedValue_0 = [self asByteSpan:params.icacValue]; |
| } |
| request.IPKValue = [self asByteSpan:params.ipkValue]; |
| request.caseAdminSubject = params.caseAdminSubject.unsignedLongLongValue; |
| request.adminVendorId = static_cast<std::remove_reference_t<decltype(request.adminVendorId)>>( |
| params.adminVendorId.unsignedShortValue); |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)updateNOCWithParams:(MTROperationalCredentialsClusterUpdateNOCParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterNOCResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterNOCResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::UpdateNOC::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.NOCValue = [self asByteSpan:params.nocValue]; |
| if (params.icacValue != nil) { |
| auto & definedValue_0 = request.ICACValue.Emplace(); |
| definedValue_0 = [self asByteSpan:params.icacValue]; |
| } |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)updateFabricLabelWithParams:(MTROperationalCredentialsClusterUpdateFabricLabelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterNOCResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterNOCResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::UpdateFabricLabel::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.label = [self asCharSpan:params.label]; |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)removeFabricWithParams:(MTROperationalCredentialsClusterRemoveFabricParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTROperationalCredentialsClusterNOCResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| OperationalCredentialsClusterNOCResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::RemoveFabric::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.fabricIndex = params.fabricIndex.unsignedCharValue; |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)addTrustedRootCertificateWithParams:(MTROperationalCredentialsClusterAddTrustedRootCertificateParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| OperationalCredentials::Commands::AddTrustedRootCertificate::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.rootCertificate = [self asByteSpan:params.rootCertificate]; |
| |
| chip::Controller::OperationalCredentialsCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNOCsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeNOCsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFabricsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeFabricsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportedFabricsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeSupportedFabricsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCommissionedFabricsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeCommissionedFabricsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTrustedRootCertificatesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeTrustedRootCertificatesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentFabricIndexWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeCurrentFabricIndexID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOperationalCredentialsID) |
| attributeID:@(MTRAttributeIDTypeClusterOperationalCredentialsAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOperationalCredentials (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)attestationRequestWithParams:(MTROperationalCredentialsClusterAttestationRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self attestationRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTROperationalCredentialsClusterAttestationResponseParams *>(data), error); |
| }]; |
| } |
| - (void)certificateChainRequestWithParams:(MTROperationalCredentialsClusterCertificateChainRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| certificateChainRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTROperationalCredentialsClusterCertificateChainResponseParams *>(data), error); |
| }]; |
| } |
| - (void)CSRRequestWithParams:(MTROperationalCredentialsClusterCSRRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterCSRResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self CSRRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROperationalCredentialsClusterCSRResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTROperationalCredentialsClusterCSRResponseParams *>(data), error); |
| }]; |
| } |
| - (void)addNOCWithParams:(MTROperationalCredentialsClusterAddNOCParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self addNOCWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTROperationalCredentialsClusterNOCResponseParams *>(data), error); |
| }]; |
| } |
| - (void)updateNOCWithParams:(MTROperationalCredentialsClusterUpdateNOCParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self updateNOCWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTROperationalCredentialsClusterNOCResponseParams *>(data), error); |
| }]; |
| } |
| - (void)updateFabricLabelWithParams:(MTROperationalCredentialsClusterUpdateFabricLabelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self updateFabricLabelWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTROperationalCredentialsClusterNOCResponseParams *>(data), error); |
| }]; |
| } |
| - (void)removeFabricWithParams:(MTROperationalCredentialsClusterRemoveFabricParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self removeFabricWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTROperationalCredentialsClusterNOCResponseParams *>(data), error); |
| }]; |
| } |
| - (void)addTrustedRootCertificateWithParams:(MTROperationalCredentialsClusterAddTrustedRootCertificateParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self addTrustedRootCertificateWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterGroupKeyManagement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GroupKeyManagement::Commands::KeySetWrite::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupKeySet.groupKeySetID = params.groupKeySet.groupKeySetID.unsignedShortValue; |
| request.groupKeySet.groupKeySecurityPolicy |
| = static_cast<std::remove_reference_t<decltype(request.groupKeySet.groupKeySecurityPolicy)>>( |
| params.groupKeySet.groupKeySecurityPolicy.unsignedCharValue); |
| if (params.groupKeySet.epochKey0 == nil) { |
| request.groupKeySet.epochKey0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = request.groupKeySet.epochKey0.SetNonNull(); |
| nonNullValue_1 = [self asByteSpan:params.groupKeySet.epochKey0]; |
| } |
| if (params.groupKeySet.epochStartTime0 == nil) { |
| request.groupKeySet.epochStartTime0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = request.groupKeySet.epochStartTime0.SetNonNull(); |
| nonNullValue_1 = params.groupKeySet.epochStartTime0.unsignedLongLongValue; |
| } |
| if (params.groupKeySet.epochKey1 == nil) { |
| request.groupKeySet.epochKey1.SetNull(); |
| } else { |
| auto & nonNullValue_1 = request.groupKeySet.epochKey1.SetNonNull(); |
| nonNullValue_1 = [self asByteSpan:params.groupKeySet.epochKey1]; |
| } |
| if (params.groupKeySet.epochStartTime1 == nil) { |
| request.groupKeySet.epochStartTime1.SetNull(); |
| } else { |
| auto & nonNullValue_1 = request.groupKeySet.epochStartTime1.SetNonNull(); |
| nonNullValue_1 = params.groupKeySet.epochStartTime1.unsignedLongLongValue; |
| } |
| if (params.groupKeySet.epochKey2 == nil) { |
| request.groupKeySet.epochKey2.SetNull(); |
| } else { |
| auto & nonNullValue_1 = request.groupKeySet.epochKey2.SetNonNull(); |
| nonNullValue_1 = [self asByteSpan:params.groupKeySet.epochKey2]; |
| } |
| if (params.groupKeySet.epochStartTime2 == nil) { |
| request.groupKeySet.epochStartTime2.SetNull(); |
| } else { |
| auto & nonNullValue_1 = request.groupKeySet.epochStartTime2.SetNonNull(); |
| nonNullValue_1 = params.groupKeySet.epochStartTime2.unsignedLongLongValue; |
| } |
| |
| chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)keySetReadWithParams:(MTRGroupKeyManagementClusterKeySetReadParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGroupKeyManagementClusterKeySetReadResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GroupKeyManagementClusterKeySetReadResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GroupKeyManagement::Commands::KeySetRead::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupKeySetID = params.groupKeySetID.unsignedShortValue; |
| |
| chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)keySetRemoveWithParams:(MTRGroupKeyManagementClusterKeySetRemoveParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GroupKeyManagement::Commands::KeySetRemove::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.groupKeySetID = params.groupKeySetID.unsignedShortValue; |
| |
| chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)keySetReadAllIndicesWithParams:(MTRGroupKeyManagementClusterKeySetReadAllIndicesParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| GroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| GroupKeyManagement::Commands::KeySetReadAllIndices::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.groupKeySetIDs)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.groupKeySetIDs.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.groupKeySetIDs.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.groupKeySetIDs.count; ++i_0) { |
| if (![params.groupKeySetIDs[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.groupKeySetIDs[i_0]; |
| listHolder_0->mList[i_0] = element_0.unsignedShortValue; |
| } |
| request.groupKeySetIDs = ListType_0(listHolder_0->mList, params.groupKeySetIDs.count); |
| } else { |
| request.groupKeySetIDs = ListType_0(); |
| } |
| } |
| |
| chip::Controller::GroupKeyManagementCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGroupKeyMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeGroupKeyMapID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeGroupKeyMapWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeGroupKeyMapWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeGroupKeyMapWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeGroupKeyMapID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGroupTableWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeGroupTableID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxGroupsPerFabricWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeMaxGroupsPerFabricID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxGroupKeysPerFabricWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeMaxGroupKeysPerFabricID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeGroupKeyManagementID) |
| attributeID:@(MTRAttributeIDTypeClusterGroupKeyManagementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterGroupKeyManagement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self keySetWriteWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)keySetReadWithParams:(MTRGroupKeyManagementClusterKeySetReadParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self keySetReadWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRGroupKeyManagementClusterKeySetReadResponseParams *>(data), error); |
| }]; |
| } |
| - (void)keySetRemoveWithParams:(MTRGroupKeyManagementClusterKeySetRemoveParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self keySetRemoveWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)keySetReadAllIndicesWithParams:(MTRGroupKeyManagementClusterKeySetReadAllIndicesParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self keySetReadAllIndicesWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterFixedLabel |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLabelListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFixedLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterFixedLabelAttributeLabelListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFixedLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterFixedLabelAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFixedLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterFixedLabelAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFixedLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterFixedLabelAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFixedLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterFixedLabelAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFixedLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterFixedLabelAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterFixedLabel (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterUserLabel |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLabelListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeLabelListID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLabelListWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLabelListWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLabelListWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeLabelListID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUserLabelID) |
| attributeID:@(MTRAttributeIDTypeClusterUserLabelAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterUserLabel (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBooleanState |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStateValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBooleanStateID) |
| attributeID:@(MTRAttributeIDTypeClusterBooleanStateAttributeStateValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBooleanStateID) |
| attributeID:@(MTRAttributeIDTypeClusterBooleanStateAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBooleanStateID) |
| attributeID:@(MTRAttributeIDTypeClusterBooleanStateAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBooleanStateID) |
| attributeID:@(MTRAttributeIDTypeClusterBooleanStateAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBooleanStateID) |
| attributeID:@(MTRAttributeIDTypeClusterBooleanStateAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBooleanStateID) |
| attributeID:@(MTRAttributeIDTypeClusterBooleanStateAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBooleanState (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterModeSelect |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)changeToModeWithParams:(MTRModeSelectClusterChangeToModeParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ModeSelect::Commands::ChangeToMode::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.newMode = params.newMode.unsignedCharValue; |
| |
| chip::Controller::ModeSelectCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDescriptionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeDescriptionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStandardNamespaceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeStandardNamespaceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportedModesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeSupportedModesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeCurrentModeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStartUpModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeStartUpModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeStartUpModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeStartUpModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeStartUpModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeStartUpModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOnModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeOnModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOnModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOnModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOnModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeOnModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeModeSelectID) |
| attributeID:@(MTRAttributeIDTypeClusterModeSelectAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterModeSelect (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)changeToModeWithParams:(MTRModeSelectClusterChangeToModeParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self changeToModeWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterDoorLock |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::LockDoor::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| if (params != nil) { |
| if (params.pinCode != nil) { |
| auto & definedValue_0 = request.pinCode.Emplace(); |
| definedValue_0 = [self asByteSpan:params.pinCode]; |
| } |
| } |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::UnlockDoor::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| if (params != nil) { |
| if (params.pinCode != nil) { |
| auto & definedValue_0 = request.pinCode.Emplace(); |
| definedValue_0 = [self asByteSpan:params.pinCode]; |
| } |
| } |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::UnlockWithTimeout::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.timeout = params.timeout.unsignedShortValue; |
| if (params.pinCode != nil) { |
| auto & definedValue_0 = request.pinCode.Emplace(); |
| definedValue_0 = [self asByteSpan:params.pinCode]; |
| } |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::SetWeekDaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.weekDayIndex = params.weekDayIndex.unsignedCharValue; |
| request.userIndex = params.userIndex.unsignedShortValue; |
| request.daysMask |
| = static_cast<std::remove_reference_t<decltype(request.daysMask)>>(params.daysMask.unsignedCharValue); |
| request.startHour = params.startHour.unsignedCharValue; |
| request.startMinute = params.startMinute.unsignedCharValue; |
| request.endHour = params.endHour.unsignedCharValue; |
| request.endMinute = params.endMinute.unsignedCharValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDoorLockClusterGetWeekDayScheduleResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DoorLockClusterGetWeekDayScheduleResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::GetWeekDaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.weekDayIndex = params.weekDayIndex.unsignedCharValue; |
| request.userIndex = params.userIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::ClearWeekDaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.weekDayIndex = params.weekDayIndex.unsignedCharValue; |
| request.userIndex = params.userIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::SetYearDaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.yearDayIndex = params.yearDayIndex.unsignedCharValue; |
| request.userIndex = params.userIndex.unsignedShortValue; |
| request.localStartTime = params.localStartTime.unsignedIntValue; |
| request.localEndTime = params.localEndTime.unsignedIntValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDoorLockClusterGetYearDayScheduleResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DoorLockClusterGetYearDayScheduleResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::GetYearDaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.yearDayIndex = params.yearDayIndex.unsignedCharValue; |
| request.userIndex = params.userIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::ClearYearDaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.yearDayIndex = params.yearDayIndex.unsignedCharValue; |
| request.userIndex = params.userIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::SetHolidaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.holidayIndex = params.holidayIndex.unsignedCharValue; |
| request.localStartTime = params.localStartTime.unsignedIntValue; |
| request.localEndTime = params.localEndTime.unsignedIntValue; |
| request.operatingMode |
| = static_cast<std::remove_reference_t<decltype(request.operatingMode)>>(params.operatingMode.unsignedCharValue); |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDoorLockClusterGetHolidayScheduleResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DoorLockClusterGetHolidayScheduleResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::GetHolidaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.holidayIndex = params.holidayIndex.unsignedCharValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::ClearHolidaySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.holidayIndex = params.holidayIndex.unsignedCharValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::SetUser::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.operationType |
| = static_cast<std::remove_reference_t<decltype(request.operationType)>>(params.operationType.unsignedCharValue); |
| request.userIndex = params.userIndex.unsignedShortValue; |
| if (params.userName == nil) { |
| request.userName.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userName.SetNonNull(); |
| nonNullValue_0 = [self asCharSpan:params.userName]; |
| } |
| if (params.userUniqueId == nil) { |
| request.userUniqueId.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userUniqueId.SetNonNull(); |
| nonNullValue_0 = params.userUniqueId.unsignedIntValue; |
| } |
| if (params.userStatus == nil) { |
| request.userStatus.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userStatus.SetNonNull(); |
| nonNullValue_0 |
| = static_cast<std::remove_reference_t<decltype(nonNullValue_0)>>(params.userStatus.unsignedCharValue); |
| } |
| if (params.userType == nil) { |
| request.userType.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userType.SetNonNull(); |
| nonNullValue_0 |
| = static_cast<std::remove_reference_t<decltype(nonNullValue_0)>>(params.userType.unsignedCharValue); |
| } |
| if (params.credentialRule == nil) { |
| request.credentialRule.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.credentialRule.SetNonNull(); |
| nonNullValue_0 |
| = static_cast<std::remove_reference_t<decltype(nonNullValue_0)>>(params.credentialRule.unsignedCharValue); |
| } |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDoorLockClusterGetUserResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DoorLockClusterGetUserResponseCallbackType successCb, MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::GetUser::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.userIndex = params.userIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::ClearUser::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.userIndex = params.userIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDoorLockClusterSetCredentialResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDoorLockClusterSetCredentialResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DoorLockClusterSetCredentialResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::SetCredential::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.operationType |
| = static_cast<std::remove_reference_t<decltype(request.operationType)>>(params.operationType.unsignedCharValue); |
| request.credential.credentialType |
| = static_cast<std::remove_reference_t<decltype(request.credential.credentialType)>>( |
| params.credential.credentialType.unsignedCharValue); |
| request.credential.credentialIndex = params.credential.credentialIndex.unsignedShortValue; |
| request.credentialData = [self asByteSpan:params.credentialData]; |
| if (params.userIndex == nil) { |
| request.userIndex.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userIndex.SetNonNull(); |
| nonNullValue_0 = params.userIndex.unsignedShortValue; |
| } |
| if (params.userStatus == nil) { |
| request.userStatus.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userStatus.SetNonNull(); |
| nonNullValue_0 |
| = static_cast<std::remove_reference_t<decltype(nonNullValue_0)>>(params.userStatus.unsignedCharValue); |
| } |
| if (params.userType == nil) { |
| request.userType.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.userType.SetNonNull(); |
| nonNullValue_0 |
| = static_cast<std::remove_reference_t<decltype(nonNullValue_0)>>(params.userType.unsignedCharValue); |
| } |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRDoorLockClusterGetCredentialStatusResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| DoorLockClusterGetCredentialStatusResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::GetCredentialStatus::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.credential.credentialType |
| = static_cast<std::remove_reference_t<decltype(request.credential.credentialType)>>( |
| params.credential.credentialType.unsignedCharValue); |
| request.credential.credentialIndex = params.credential.credentialIndex.unsignedShortValue; |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| DoorLock::Commands::ClearCredential::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| if (params.credential == nil) { |
| request.credential.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.credential.SetNonNull(); |
| nonNullValue_0.credentialType = static_cast<std::remove_reference_t<decltype(nonNullValue_0.credentialType)>>( |
| params.credential.credentialType.unsignedCharValue); |
| nonNullValue_0.credentialIndex = params.credential.credentialIndex.unsignedShortValue; |
| } |
| |
| chip::Controller::DoorLockCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLockStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLockStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLockTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLockTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActuatorEnabledWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeActuatorEnabledID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDoorStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeDoorStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDoorOpenEventsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeDoorOpenEventsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeDoorOpenEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeDoorOpenEventsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeDoorOpenEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeDoorOpenEventsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDoorClosedEventsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeDoorClosedEventsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeDoorClosedEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeDoorClosedEventsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeDoorClosedEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeDoorClosedEventsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOpenPeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeOpenPeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOpenPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOpenPeriodWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOpenPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeOpenPeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfTotalUsersSupportedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfTotalUsersSupportedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfPINUsersSupportedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfPINUsersSupportedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfRFIDUsersSupportedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfRFIDUsersSupportedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfWeekDaySchedulesSupportedPerUserID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfYearDaySchedulesSupportedPerUserWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfYearDaySchedulesSupportedPerUserID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfHolidaySchedulesSupportedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfHolidaySchedulesSupportedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxPINCodeLengthWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeMaxPINCodeLengthID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinPINCodeLengthWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeMinPINCodeLengthID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxRFIDCodeLengthWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeMaxRFIDCodeLengthID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinRFIDCodeLengthWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeMinRFIDCodeLengthID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCredentialRulesSupportWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeCredentialRulesSupportID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfCredentialsSupportedPerUserWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeNumberOfCredentialsSupportedPerUserID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLanguageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLanguageID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLanguageWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLanguageWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLanguageWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLanguageID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLEDSettingsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLEDSettingsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLEDSettingsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLEDSettingsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLEDSettingsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLEDSettingsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAutoRelockTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeAutoRelockTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeAutoRelockTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeAutoRelockTimeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeAutoRelockTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeAutoRelockTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSoundVolumeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeSoundVolumeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeSoundVolumeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeSoundVolumeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeSoundVolumeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeSoundVolumeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOperatingModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeOperatingModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOperatingModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOperatingModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOperatingModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeOperatingModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportedOperatingModesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeSupportedOperatingModesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDefaultConfigurationRegisterWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeDefaultConfigurationRegisterID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnableLocalProgrammingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnableLocalProgrammingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnableLocalProgrammingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnableLocalProgrammingWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeEnableLocalProgrammingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnableLocalProgrammingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnableOneTouchLockingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnableOneTouchLockingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnableOneTouchLockingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnableOneTouchLockingWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeEnableOneTouchLockingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnableOneTouchLockingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnableInsideStatusLEDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnableInsideStatusLEDID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnableInsideStatusLEDWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnableInsideStatusLEDWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeEnableInsideStatusLEDWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnableInsideStatusLEDID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnablePrivacyModeButtonWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnablePrivacyModeButtonID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnablePrivacyModeButtonWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnablePrivacyModeButtonWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeEnablePrivacyModeButtonWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeEnablePrivacyModeButtonID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLocalProgrammingFeaturesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLocalProgrammingFeaturesID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLocalProgrammingFeaturesWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLocalProgrammingFeaturesWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeLocalProgrammingFeaturesWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeLocalProgrammingFeaturesID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWrongCodeEntryLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeWrongCodeEntryLimitID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeWrongCodeEntryLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeWrongCodeEntryLimitWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeWrongCodeEntryLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeWrongCodeEntryLimitID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUserCodeTemporaryDisableTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeUserCodeTemporaryDisableTimeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUserCodeTemporaryDisableTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUserCodeTemporaryDisableTimeWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeUserCodeTemporaryDisableTimeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeUserCodeTemporaryDisableTimeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSendPINOverTheAirWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeSendPINOverTheAirID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeSendPINOverTheAirWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeSendPINOverTheAirWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeSendPINOverTheAirWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeSendPINOverTheAirID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRequirePINforRemoteOperationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeRequirePINforRemoteOperationID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRequirePINforRemoteOperationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRequirePINforRemoteOperationWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeRequirePINforRemoteOperationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeRequirePINforRemoteOperationID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeExpiringUserTimeoutWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeExpiringUserTimeoutID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeExpiringUserTimeoutWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeExpiringUserTimeoutWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeExpiringUserTimeoutWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeExpiringUserTimeoutID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeDoorLockID) |
| attributeID:@(MTRAttributeIDTypeClusterDoorLockAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterDoorLock (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self lockDoorWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self unlockDoorWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self unlockWithTimeoutWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self setWeekDayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getWeekDayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDoorLockClusterGetWeekDayScheduleResponseParams *>(data), error); |
| }]; |
| } |
| - (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearWeekDayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self setYearDayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getYearDayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDoorLockClusterGetYearDayScheduleResponseParams *>(data), error); |
| }]; |
| } |
| - (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearYearDayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self setHolidayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getHolidayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDoorLockClusterGetHolidayScheduleResponseParams *>(data), error); |
| }]; |
| } |
| - (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidayScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearHolidayScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self setUserWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self getUserWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDoorLockClusterGetUserResponseParams *>(data), error); |
| }]; |
| } |
| - (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearUserWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRDoorLockClusterSetCredentialResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self setCredentialWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDoorLockClusterSetCredentialResponseParams *>(data), error); |
| }]; |
| } |
| - (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getCredentialStatusWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRDoorLockClusterGetCredentialStatusResponseParams *>(data), error); |
| }]; |
| } |
| - (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearCredentialWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterWindowCovering |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)upOrOpenWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self upOrOpenWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)upOrOpenWithParams:(MTRWindowCoveringClusterUpOrOpenParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::UpOrOpen::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)downOrCloseWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self downOrCloseWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)downOrCloseWithParams:(MTRWindowCoveringClusterDownOrCloseParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::DownOrClose::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopMotionWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self stopMotionWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)stopMotionWithParams:(MTRWindowCoveringClusterStopMotionParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::StopMotion::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)goToLiftValueWithParams:(MTRWindowCoveringClusterGoToLiftValueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::GoToLiftValue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.liftValue = params.liftValue.unsignedShortValue; |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)goToLiftPercentageWithParams:(MTRWindowCoveringClusterGoToLiftPercentageParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::GoToLiftPercentage::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.liftPercent100thsValue = params.liftPercent100thsValue.unsignedShortValue; |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)goToTiltValueWithParams:(MTRWindowCoveringClusterGoToTiltValueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::GoToTiltValue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.tiltValue = params.tiltValue.unsignedShortValue; |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)goToTiltPercentageWithParams:(MTRWindowCoveringClusterGoToTiltPercentageParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| WindowCovering::Commands::GoToTiltPercentage::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.tiltPercent100thsValue = params.tiltPercent100thsValue.unsignedShortValue; |
| |
| chip::Controller::WindowCoveringCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalClosedLimitLiftWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributePhysicalClosedLimitLiftID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalClosedLimitTiltWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributePhysicalClosedLimitTiltID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionLiftWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeCurrentPositionLiftID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionTiltWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeCurrentPositionTiltID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfActuationsLiftWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeNumberOfActuationsLiftID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfActuationsTiltWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeNumberOfActuationsTiltID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeConfigStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeConfigStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionLiftPercentageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeCurrentPositionLiftPercentageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionTiltPercentageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeCurrentPositionTiltPercentageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOperationalStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeOperationalStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTargetPositionLiftPercent100thsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeTargetPositionLiftPercent100thsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTargetPositionTiltPercent100thsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeTargetPositionTiltPercent100thsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEndProductTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeEndProductTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionLiftPercent100thsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeCurrentPositionLiftPercent100thsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentPositionTiltPercent100thsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeCurrentPositionTiltPercent100thsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstalledOpenLimitLiftWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeInstalledOpenLimitLiftID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstalledClosedLimitLiftWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeInstalledClosedLimitLiftID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstalledOpenLimitTiltWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeInstalledOpenLimitTiltID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstalledClosedLimitTiltWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeInstalledClosedLimitTiltID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSafetyStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeSafetyStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWindowCoveringID) |
| attributeID:@(MTRAttributeIDTypeClusterWindowCoveringAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterWindowCovering (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)upOrOpenWithParams:(MTRWindowCoveringClusterUpOrOpenParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self upOrOpenWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)upOrOpenWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self upOrOpenWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)downOrCloseWithParams:(MTRWindowCoveringClusterDownOrCloseParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self downOrCloseWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)downOrCloseWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self downOrCloseWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)stopMotionWithParams:(MTRWindowCoveringClusterStopMotionParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stopMotionWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stopMotionWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stopMotionWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)goToLiftValueWithParams:(MTRWindowCoveringClusterGoToLiftValueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self goToLiftValueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)goToLiftPercentageWithParams:(MTRWindowCoveringClusterGoToLiftPercentageParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self goToLiftPercentageWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)goToTiltValueWithParams:(MTRWindowCoveringClusterGoToTiltValueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self goToTiltValueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)goToTiltPercentageWithParams:(MTRWindowCoveringClusterGoToTiltPercentageParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self goToTiltPercentageWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterBarrierControl |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)barrierControlGoToPercentWithParams:(MTRBarrierControlClusterBarrierControlGoToPercentParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| BarrierControl::Commands::BarrierControlGoToPercent::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.percentOpen = params.percentOpen.unsignedCharValue; |
| |
| chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)barrierControlStopWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self barrierControlStopWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)barrierControlStopWithParams:(MTRBarrierControlClusterBarrierControlStopParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| BarrierControl::Commands::BarrierControlStop::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::BarrierControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierMovingStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierMovingStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierSafetyStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierSafetyStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierCapabilitiesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCapabilitiesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierOpenEventsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierOpenEventsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBarrierOpenEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBarrierOpenEventsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBarrierOpenEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierOpenEventsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierCloseEventsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCloseEventsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBarrierCloseEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBarrierCloseEventsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBarrierCloseEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCloseEventsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierCommandOpenEventsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCommandOpenEventsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBarrierCommandOpenEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBarrierCommandOpenEventsWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeBarrierCommandOpenEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCommandOpenEventsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierCommandCloseEventsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCommandCloseEventsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBarrierCommandCloseEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBarrierCommandCloseEventsWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeBarrierCommandCloseEventsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierCommandCloseEventsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierOpenPeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierOpenPeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBarrierOpenPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBarrierOpenPeriodWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBarrierOpenPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierOpenPeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierClosePeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierClosePeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBarrierClosePeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBarrierClosePeriodWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBarrierClosePeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierClosePeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBarrierPositionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeBarrierPositionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBarrierControlID) |
| attributeID:@(MTRAttributeIDTypeClusterBarrierControlAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBarrierControl (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)barrierControlGoToPercentWithParams:(MTRBarrierControlClusterBarrierControlGoToPercentParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self barrierControlGoToPercentWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)barrierControlStopWithParams:(MTRBarrierControlClusterBarrierControlStopParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self barrierControlStopWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)barrierControlStopWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self barrierControlStopWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterPumpConfigurationAndControl |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxPressureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxPressureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxSpeedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxSpeedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxFlowWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxFlowID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinConstPressureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMinConstPressureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxConstPressureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxConstPressureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinCompPressureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMinCompPressureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxCompPressureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxCompPressureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinConstSpeedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMinConstSpeedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxConstSpeedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxConstSpeedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinConstFlowWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMinConstFlowID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxConstFlowWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxConstFlowID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinConstTempWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMinConstTempID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxConstTempWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeMaxConstTempID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePumpStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributePumpStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEffectiveOperationModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeEffectiveOperationModeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEffectiveControlModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeEffectiveControlModeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCapacityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeCapacityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSpeedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeSpeedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLifetimeRunningHoursWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeLifetimeRunningHoursID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLifetimeRunningHoursWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLifetimeRunningHoursWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLifetimeRunningHoursWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeLifetimeRunningHoursID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributePowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLifetimeEnergyConsumedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeLifetimeEnergyConsumedID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLifetimeEnergyConsumedWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLifetimeEnergyConsumedWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeLifetimeEnergyConsumedWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeLifetimeEnergyConsumedID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOperationModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeOperationModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOperationModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOperationModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOperationModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeOperationModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeControlModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeControlModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeControlModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeControlModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeControlModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeControlModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePumpConfigurationAndControlID) |
| attributeID:@(MTRAttributeIDTypeClusterPumpConfigurationAndControlAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPumpConfigurationAndControl (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterThermostat |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)setpointRaiseLowerWithParams:(MTRThermostatClusterSetpointRaiseLowerParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Thermostat::Commands::SetpointRaiseLower::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.mode = static_cast<std::remove_reference_t<decltype(request.mode)>>(params.mode.unsignedCharValue); |
| request.amount = params.amount.charValue; |
| |
| chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Thermostat::Commands::SetWeeklySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.numberOfTransitionsForSequence = params.numberOfTransitionsForSequence.unsignedCharValue; |
| request.dayOfWeekForSequence = static_cast<std::remove_reference_t<decltype(request.dayOfWeekForSequence)>>( |
| params.dayOfWeekForSequence.unsignedCharValue); |
| request.modeForSequence = static_cast<std::remove_reference_t<decltype(request.modeForSequence)>>( |
| params.modeForSequence.unsignedCharValue); |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.transitions)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.transitions.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.transitions.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.transitions.count; ++i_0) { |
| if (![params.transitions[i_0] isKindOfClass:[MTRThermostatClusterThermostatScheduleTransition class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRThermostatClusterThermostatScheduleTransition *) params.transitions[i_0]; |
| listHolder_0->mList[i_0].transitionTime = element_0.transitionTime.unsignedShortValue; |
| if (element_0.heatSetpoint == nil) { |
| listHolder_0->mList[i_0].heatSetpoint.SetNull(); |
| } else { |
| auto & nonNullValue_2 = listHolder_0->mList[i_0].heatSetpoint.SetNonNull(); |
| nonNullValue_2 = element_0.heatSetpoint.shortValue; |
| } |
| if (element_0.coolSetpoint == nil) { |
| listHolder_0->mList[i_0].coolSetpoint.SetNull(); |
| } else { |
| auto & nonNullValue_2 = listHolder_0->mList[i_0].coolSetpoint.SetNonNull(); |
| nonNullValue_2 = element_0.coolSetpoint.shortValue; |
| } |
| } |
| request.transitions = ListType_0(listHolder_0->mList, params.transitions.count); |
| } else { |
| request.transitions = ListType_0(); |
| } |
| } |
| |
| chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRThermostatClusterGetWeeklyScheduleResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ThermostatClusterGetWeeklyScheduleResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Thermostat::Commands::GetWeeklySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.daysToReturn |
| = static_cast<std::remove_reference_t<decltype(request.daysToReturn)>>(params.daysToReturn.unsignedCharValue); |
| request.modeToReturn |
| = static_cast<std::remove_reference_t<decltype(request.modeToReturn)>>(params.modeToReturn.unsignedCharValue); |
| |
| chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)clearWeeklyScheduleWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self clearWeeklyScheduleWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)clearWeeklyScheduleWithParams:(MTRThermostatClusterClearWeeklyScheduleParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Thermostat::Commands::ClearWeeklySchedule::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::ThermostatCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLocalTemperatureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeLocalTemperatureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOutdoorTemperatureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOutdoorTemperatureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupancyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupancyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAbsMinHeatSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeAbsMinHeatSetpointLimitID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAbsMaxHeatSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeAbsMaxHeatSetpointLimitID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAbsMinCoolSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeAbsMinCoolSetpointLimitID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAbsMaxCoolSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeAbsMaxCoolSetpointLimitID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePICoolingDemandWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributePICoolingDemandID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePIHeatingDemandWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributePIHeatingDemandID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHVACSystemTypeConfigurationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeHVACSystemTypeConfigurationID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeHVACSystemTypeConfigurationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeHVACSystemTypeConfigurationWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeHVACSystemTypeConfigurationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeHVACSystemTypeConfigurationID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLocalTemperatureCalibrationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeLocalTemperatureCalibrationID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLocalTemperatureCalibrationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLocalTemperatureCalibrationWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeLocalTemperatureCalibrationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeLocalTemperatureCalibrationID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupiedCoolingSetpointWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedCoolingSetpointID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOccupiedCoolingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOccupiedCoolingSetpointWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeOccupiedCoolingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedCoolingSetpointID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupiedHeatingSetpointWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedHeatingSetpointID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOccupiedHeatingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOccupiedHeatingSetpointWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeOccupiedHeatingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedHeatingSetpointID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUnoccupiedCoolingSetpointWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedCoolingSetpointID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUnoccupiedCoolingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUnoccupiedCoolingSetpointWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeUnoccupiedCoolingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedCoolingSetpointID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUnoccupiedHeatingSetpointWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedHeatingSetpointID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUnoccupiedHeatingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUnoccupiedHeatingSetpointWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeUnoccupiedHeatingSetpointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedHeatingSetpointID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinHeatSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMinHeatSetpointLimitID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMinHeatSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMinHeatSetpointLimitWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMinHeatSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMinHeatSetpointLimitID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxHeatSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMaxHeatSetpointLimitID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMaxHeatSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMaxHeatSetpointLimitWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMaxHeatSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMaxHeatSetpointLimitID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinCoolSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMinCoolSetpointLimitID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMinCoolSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMinCoolSetpointLimitWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMinCoolSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMinCoolSetpointLimitID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxCoolSetpointLimitWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMaxCoolSetpointLimitID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMaxCoolSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMaxCoolSetpointLimitWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMaxCoolSetpointLimitWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMaxCoolSetpointLimitID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinSetpointDeadBandWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMinSetpointDeadBandID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMinSetpointDeadBandWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMinSetpointDeadBandWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMinSetpointDeadBandWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeMinSetpointDeadBandID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRemoteSensingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeRemoteSensingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRemoteSensingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRemoteSensingWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeRemoteSensingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeRemoteSensingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeControlSequenceOfOperationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeControlSequenceOfOperationID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeControlSequenceOfOperationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeControlSequenceOfOperationWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeControlSequenceOfOperationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeControlSequenceOfOperationID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSystemModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSystemModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeSystemModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeSystemModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeSystemModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSystemModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeThermostatRunningModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeThermostatRunningModeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStartOfWeekWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeStartOfWeekID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfWeeklyTransitionsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeNumberOfWeeklyTransitionsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfDailyTransitionsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeNumberOfDailyTransitionsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTemperatureSetpointHoldWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeTemperatureSetpointHoldWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeTemperatureSetpointHoldWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeTemperatureSetpointHoldWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTemperatureSetpointHoldDurationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldDurationID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeTemperatureSetpointHoldDurationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeTemperatureSetpointHoldDurationWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeTemperatureSetpointHoldDurationWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeTemperatureSetpointHoldDurationID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeThermostatProgrammingOperationModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeThermostatProgrammingOperationModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeThermostatProgrammingOperationModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeThermostatProgrammingOperationModeWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeThermostatProgrammingOperationModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeThermostatProgrammingOperationModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeThermostatRunningStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeThermostatRunningStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSetpointChangeSourceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSetpointChangeSourceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSetpointChangeAmountWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSetpointChangeAmountID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSetpointChangeSourceTimestampWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeSetpointChangeSourceTimestampID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupiedSetbackWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedSetbackID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOccupiedSetbackWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOccupiedSetbackWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOccupiedSetbackWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedSetbackID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupiedSetbackMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedSetbackMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupiedSetbackMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeOccupiedSetbackMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUnoccupiedSetbackWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedSetbackID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUnoccupiedSetbackWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUnoccupiedSetbackWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeUnoccupiedSetbackWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedSetbackID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUnoccupiedSetbackMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedSetbackMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUnoccupiedSetbackMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeUnoccupiedSetbackMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEmergencyHeatDeltaWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeEmergencyHeatDeltaID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEmergencyHeatDeltaWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEmergencyHeatDeltaWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeEmergencyHeatDeltaWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeEmergencyHeatDeltaID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACTypeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACTypeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACTypeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACCapacityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACCapacityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACCapacityWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACCapacityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACRefrigerantTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACRefrigerantTypeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACRefrigerantTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACRefrigerantTypeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACRefrigerantTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACRefrigerantTypeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACCompressorTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCompressorTypeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACCompressorTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACCompressorTypeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACCompressorTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCompressorTypeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACErrorCodeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACErrorCodeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACErrorCodeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACErrorCodeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACErrorCodeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACErrorCodeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACLouverPositionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACLouverPositionID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACLouverPositionWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACLouverPositionWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACLouverPositionWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACLouverPositionID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACCoilTemperatureWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCoilTemperatureID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeACCapacityformatWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeACCapacityformatWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeACCapacityformatWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeACCapacityformatWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeACCapacityformatID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterThermostat (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)setpointRaiseLowerWithParams:(MTRThermostatClusterSetpointRaiseLowerParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self setpointRaiseLowerWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self setWeeklyScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getWeeklyScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRThermostatClusterGetWeeklyScheduleResponseParams *>(data), error); |
| }]; |
| } |
| - (void)clearWeeklyScheduleWithParams:(MTRThermostatClusterClearWeeklyScheduleParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearWeeklyScheduleWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)clearWeeklyScheduleWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self clearWeeklyScheduleWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterFanControl |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFanModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeFanModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeFanModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeFanModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeFanModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeFanModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFanModeSequenceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeFanModeSequenceID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeFanModeSequenceWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeFanModeSequenceWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeFanModeSequenceWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeFanModeSequenceID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePercentSettingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributePercentSettingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePercentSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePercentSettingWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributePercentSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributePercentSettingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePercentCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributePercentCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSpeedMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeSpeedMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSpeedSettingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeSpeedSettingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeSpeedSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeSpeedSettingWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeSpeedSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeSpeedSettingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSpeedCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeSpeedCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRockSupportWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeRockSupportID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRockSettingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeRockSettingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRockSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRockSettingWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeRockSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeRockSettingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWindSupportWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeWindSupportID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWindSettingWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeWindSettingID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeWindSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeWindSettingWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeWindSettingWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeWindSettingID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFanControlID) |
| attributeID:@(MTRAttributeIDTypeClusterFanControlAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterFanControl (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterThermostatUserInterfaceConfiguration |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTemperatureDisplayModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeTemperatureDisplayModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeTemperatureDisplayModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeTemperatureDisplayModeWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeTemperatureDisplayModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeTemperatureDisplayModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeKeypadLockoutWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeKeypadLockoutID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeKeypadLockoutWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeKeypadLockoutWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeKeypadLockoutWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeKeypadLockoutID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeScheduleProgrammingVisibilityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeScheduleProgrammingVisibilityID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeScheduleProgrammingVisibilityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeScheduleProgrammingVisibilityWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeScheduleProgrammingVisibilityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeScheduleProgrammingVisibilityID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeThermostatUserInterfaceConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterThermostatUserInterfaceConfigurationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterThermostatUserInterfaceConfiguration (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterColorControl |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)moveToHueWithParams:(MTRColorControlClusterMoveToHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveToHue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.hue = params.hue.unsignedCharValue; |
| request.direction |
| = static_cast<std::remove_reference_t<decltype(request.direction)>>(params.direction.unsignedCharValue); |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveHueWithParams:(MTRColorControlClusterMoveHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveHue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.moveMode |
| = static_cast<std::remove_reference_t<decltype(request.moveMode)>>(params.moveMode.unsignedCharValue); |
| request.rate = params.rate.unsignedCharValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stepHueWithParams:(MTRColorControlClusterStepHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::StepHue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepMode |
| = static_cast<std::remove_reference_t<decltype(request.stepMode)>>(params.stepMode.unsignedCharValue); |
| request.stepSize = params.stepSize.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedCharValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveToSaturationWithParams:(MTRColorControlClusterMoveToSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveToSaturation::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.saturation = params.saturation.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveSaturationWithParams:(MTRColorControlClusterMoveSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveSaturation::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.moveMode |
| = static_cast<std::remove_reference_t<decltype(request.moveMode)>>(params.moveMode.unsignedCharValue); |
| request.rate = params.rate.unsignedCharValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stepSaturationWithParams:(MTRColorControlClusterStepSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::StepSaturation::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepMode |
| = static_cast<std::remove_reference_t<decltype(request.stepMode)>>(params.stepMode.unsignedCharValue); |
| request.stepSize = params.stepSize.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedCharValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveToHueAndSaturationWithParams:(MTRColorControlClusterMoveToHueAndSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveToHueAndSaturation::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.hue = params.hue.unsignedCharValue; |
| request.saturation = params.saturation.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveToColorWithParams:(MTRColorControlClusterMoveToColorParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveToColor::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.colorX = params.colorX.unsignedShortValue; |
| request.colorY = params.colorY.unsignedShortValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveColorWithParams:(MTRColorControlClusterMoveColorParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveColor::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.rateX = params.rateX.shortValue; |
| request.rateY = params.rateY.shortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stepColorWithParams:(MTRColorControlClusterStepColorParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::StepColor::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepX = params.stepX.shortValue; |
| request.stepY = params.stepY.shortValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveToColorTemperatureWithParams:(MTRColorControlClusterMoveToColorTemperatureParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveToColorTemperature::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.colorTemperature = params.colorTemperature.unsignedShortValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enhancedMoveToHueWithParams:(MTRColorControlClusterEnhancedMoveToHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::EnhancedMoveToHue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.enhancedHue = params.enhancedHue.unsignedShortValue; |
| request.direction |
| = static_cast<std::remove_reference_t<decltype(request.direction)>>(params.direction.unsignedCharValue); |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enhancedMoveHueWithParams:(MTRColorControlClusterEnhancedMoveHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::EnhancedMoveHue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.moveMode |
| = static_cast<std::remove_reference_t<decltype(request.moveMode)>>(params.moveMode.unsignedCharValue); |
| request.rate = params.rate.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enhancedStepHueWithParams:(MTRColorControlClusterEnhancedStepHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::EnhancedStepHue::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepMode |
| = static_cast<std::remove_reference_t<decltype(request.stepMode)>>(params.stepMode.unsignedCharValue); |
| request.stepSize = params.stepSize.unsignedShortValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)enhancedMoveToHueAndSaturationWithParams:(MTRColorControlClusterEnhancedMoveToHueAndSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.enhancedHue = params.enhancedHue.unsignedShortValue; |
| request.saturation = params.saturation.unsignedCharValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)colorLoopSetWithParams:(MTRColorControlClusterColorLoopSetParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::ColorLoopSet::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.updateFlags |
| = static_cast<std::remove_reference_t<decltype(request.updateFlags)>>(params.updateFlags.unsignedCharValue); |
| request.action = static_cast<std::remove_reference_t<decltype(request.action)>>(params.action.unsignedCharValue); |
| request.direction |
| = static_cast<std::remove_reference_t<decltype(request.direction)>>(params.direction.unsignedCharValue); |
| request.time = params.time.unsignedShortValue; |
| request.startHue = params.startHue.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopMoveStepWithParams:(MTRColorControlClusterStopMoveStepParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::StopMoveStep::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)moveColorTemperatureWithParams:(MTRColorControlClusterMoveColorTemperatureParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::MoveColorTemperature::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.moveMode |
| = static_cast<std::remove_reference_t<decltype(request.moveMode)>>(params.moveMode.unsignedCharValue); |
| request.rate = params.rate.unsignedShortValue; |
| request.colorTemperatureMinimumMireds = params.colorTemperatureMinimumMireds.unsignedShortValue; |
| request.colorTemperatureMaximumMireds = params.colorTemperatureMaximumMireds.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stepColorTemperatureWithParams:(MTRColorControlClusterStepColorTemperatureParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ColorControl::Commands::StepColorTemperature::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.stepMode |
| = static_cast<std::remove_reference_t<decltype(request.stepMode)>>(params.stepMode.unsignedCharValue); |
| request.stepSize = params.stepSize.unsignedShortValue; |
| request.transitionTime = params.transitionTime.unsignedShortValue; |
| request.colorTemperatureMinimumMireds = params.colorTemperatureMinimumMireds.unsignedShortValue; |
| request.colorTemperatureMaximumMireds = params.colorTemperatureMaximumMireds.unsignedShortValue; |
| request.optionsMask = params.optionsMask.unsignedCharValue; |
| request.optionsOverride = params.optionsOverride.unsignedCharValue; |
| |
| chip::Controller::ColorControlCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentHueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeCurrentHueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentSaturationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeCurrentSaturationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRemainingTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeRemainingTimeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentXWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeCurrentXID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentYWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeCurrentYID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDriftCompensationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeDriftCompensationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCompensationTextWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeCompensationTextID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorTemperatureMiredsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorTemperatureMiredsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorModeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOptionsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeOptionsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOptionsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOptionsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOptionsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeOptionsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNumberOfPrimariesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeNumberOfPrimariesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary1XWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary1XID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary1YWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary1YID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary1IntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary1IntensityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary2XWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary2XID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary2YWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary2YID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary2IntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary2IntensityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary3XWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary3XID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary3YWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary3YID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary3IntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary3IntensityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary4XWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary4XID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary4YWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary4YID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary4IntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary4IntensityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary5XWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary5XID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary5YWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary5YID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary5IntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary5IntensityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary6XWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary6XID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary6YWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary6YID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePrimary6IntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributePrimary6IntensityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWhitePointXWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeWhitePointXID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeWhitePointXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeWhitePointXWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeWhitePointXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeWhitePointXID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWhitePointYWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeWhitePointYID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeWhitePointYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeWhitePointYWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeWhitePointYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeWhitePointYID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointRXWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointRXID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointRXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointRXWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointRXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointRXID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointRYWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointRYID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointRYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointRYWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointRYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointRYID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointRIntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointRIntensityID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointRIntensityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointRIntensityWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointRIntensityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointRIntensityID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointGXWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointGXID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointGXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointGXWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointGXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointGXID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointGYWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointGYID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointGYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointGYWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointGYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointGYID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointGIntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointGIntensityID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointGIntensityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointGIntensityWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointGIntensityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointGIntensityID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointBXWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointBXID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointBXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointBXWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointBXWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointBXID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointBYWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointBYID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointBYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointBYWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointBYWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointBYID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorPointBIntensityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointBIntensityID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeColorPointBIntensityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeColorPointBIntensityWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeColorPointBIntensityWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorPointBIntensityID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnhancedCurrentHueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeEnhancedCurrentHueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnhancedColorModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeEnhancedColorModeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorLoopActiveWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorLoopActiveID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorLoopDirectionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorLoopDirectionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorLoopTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorLoopTimeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorLoopStartEnhancedHueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorLoopStartEnhancedHueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorLoopStoredEnhancedHueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorLoopStoredEnhancedHueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorCapabilitiesWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorCapabilitiesID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorTempPhysicalMinMiredsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorTempPhysicalMinMiredsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeColorTempPhysicalMaxMiredsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeColorTempPhysicalMaxMiredsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCoupleColorTempToLevelMinMiredsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeCoupleColorTempToLevelMinMiredsID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStartUpColorTemperatureMiredsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeStartUpColorTemperatureMiredsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeStartUpColorTemperatureMiredsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeStartUpColorTemperatureMiredsWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeStartUpColorTemperatureMiredsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeStartUpColorTemperatureMiredsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeColorControlID) |
| attributeID:@(MTRAttributeIDTypeClusterColorControlAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterColorControl (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)moveToHueWithParams:(MTRColorControlClusterMoveToHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToHueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveHueWithParams:(MTRColorControlClusterMoveHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveHueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stepHueWithParams:(MTRColorControlClusterStepHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stepHueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveToSaturationWithParams:(MTRColorControlClusterMoveToSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToSaturationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveSaturationWithParams:(MTRColorControlClusterMoveSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveSaturationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stepSaturationWithParams:(MTRColorControlClusterStepSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stepSaturationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveToHueAndSaturationWithParams:(MTRColorControlClusterMoveToHueAndSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToHueAndSaturationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveToColorWithParams:(MTRColorControlClusterMoveToColorParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToColorWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveColorWithParams:(MTRColorControlClusterMoveColorParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveColorWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stepColorWithParams:(MTRColorControlClusterStepColorParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stepColorWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveToColorTemperatureWithParams:(MTRColorControlClusterMoveToColorTemperatureParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveToColorTemperatureWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)enhancedMoveToHueWithParams:(MTRColorControlClusterEnhancedMoveToHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self enhancedMoveToHueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)enhancedMoveHueWithParams:(MTRColorControlClusterEnhancedMoveHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self enhancedMoveHueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)enhancedStepHueWithParams:(MTRColorControlClusterEnhancedStepHueParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self enhancedStepHueWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)enhancedMoveToHueAndSaturationWithParams:(MTRColorControlClusterEnhancedMoveToHueAndSaturationParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self enhancedMoveToHueAndSaturationWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)colorLoopSetWithParams:(MTRColorControlClusterColorLoopSetParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self colorLoopSetWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stopMoveStepWithParams:(MTRColorControlClusterStopMoveStepParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stopMoveStepWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)moveColorTemperatureWithParams:(MTRColorControlClusterMoveColorTemperatureParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self moveColorTemperatureWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)stepColorTemperatureWithParams:(MTRColorControlClusterStepColorTemperatureParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self stepColorTemperatureWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterBallastConfiguration |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalMinLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributePhysicalMinLevelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalMaxLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributePhysicalMaxLevelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBallastStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeBallastStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeMinLevelID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMinLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMinLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMinLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeMinLevelID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxLevelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeMaxLevelID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeMaxLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeMaxLevelWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeMaxLevelWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeMaxLevelID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeIntrinsicBalanceFactorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeIntrinsicBalanceFactorID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeIntrinsicBalanceFactorWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeIntrinsicBalanceFactorWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeIntrinsicBalanceFactorWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeIntrinsicBalanceFactorID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBallastFactorAdjustmentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeBallastFactorAdjustmentID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBallastFactorAdjustmentWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBallastFactorAdjustmentWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeBallastFactorAdjustmentWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeBallastFactorAdjustmentID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampQuantityWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampQuantityID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampTypeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLampTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLampTypeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLampTypeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampTypeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampManufacturerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampManufacturerID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLampManufacturerWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLampManufacturerWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLampManufacturerWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampManufacturerID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampRatedHoursWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampRatedHoursID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLampRatedHoursWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLampRatedHoursWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLampRatedHoursWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampRatedHoursID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampBurnHoursWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampBurnHoursID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLampBurnHoursWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLampBurnHoursWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLampBurnHoursWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampBurnHoursID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampAlarmModeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampAlarmModeID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLampAlarmModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLampAlarmModeWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLampAlarmModeWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampAlarmModeID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLampBurnHoursTripPointWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampBurnHoursTripPointID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLampBurnHoursTripPointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLampBurnHoursTripPointWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeLampBurnHoursTripPointWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeLampBurnHoursTripPointID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeBallastConfigurationID) |
| attributeID:@(MTRAttributeIDTypeClusterBallastConfigurationAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterBallastConfiguration (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterIlluminanceMeasurement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeMinMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeMaxMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeToleranceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeToleranceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLightSensorTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeLightSensorTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeIlluminanceMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterIlluminanceMeasurementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterIlluminanceMeasurement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterTemperatureMeasurement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeMinMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeMaxMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeToleranceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeToleranceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTemperatureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterTemperatureMeasurementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterTemperatureMeasurement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPressureMeasurement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeMinMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeMaxMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeToleranceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeToleranceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeScaledValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeScaledValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinScaledValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeMinScaledValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxScaledValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeMaxScaledValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeScaledToleranceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeScaledToleranceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeScaleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeScaleID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypePressureMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterPressureMeasurementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterPressureMeasurement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterFlowMeasurement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeMinMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeMaxMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeToleranceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeToleranceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeFlowMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterFlowMeasurementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterFlowMeasurement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterRelativeHumidityMeasurement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMinMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeMinMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMaxMeasuredValueWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeMaxMeasuredValueID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeToleranceWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeToleranceID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeRelativeHumidityMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterRelativeHumidityMeasurementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterRelativeHumidityMeasurement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOccupancySensing |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupancyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupancySensorTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancySensorTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOccupancySensorTypeBitmapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeOccupancySensorTypeBitmapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePirOccupiedToUnoccupiedDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePirOccupiedToUnoccupiedDelayID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePirOccupiedToUnoccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePirOccupiedToUnoccupiedDelayWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributePirOccupiedToUnoccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePirOccupiedToUnoccupiedDelayID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePirUnoccupiedToOccupiedDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePirUnoccupiedToOccupiedDelayID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePirUnoccupiedToOccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePirUnoccupiedToOccupiedDelayWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributePirUnoccupiedToOccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePirUnoccupiedToOccupiedDelayID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePirUnoccupiedToOccupiedThresholdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePirUnoccupiedToOccupiedThresholdID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePirUnoccupiedToOccupiedThresholdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePirUnoccupiedToOccupiedThresholdWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributePirUnoccupiedToOccupiedThresholdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePirUnoccupiedToOccupiedThresholdID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUltrasonicOccupiedToUnoccupiedDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeUltrasonicOccupiedToUnoccupiedDelayID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUltrasonicOccupiedToUnoccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUltrasonicOccupiedToUnoccupiedDelayWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeUltrasonicOccupiedToUnoccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeUltrasonicOccupiedToUnoccupiedDelayID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUltrasonicUnoccupiedToOccupiedDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeUltrasonicUnoccupiedToOccupiedDelayID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUltrasonicUnoccupiedToOccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUltrasonicUnoccupiedToOccupiedDelayWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeUltrasonicUnoccupiedToOccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeUltrasonicUnoccupiedToOccupiedDelayID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUltrasonicUnoccupiedToOccupiedThresholdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeUltrasonicUnoccupiedToOccupiedThresholdID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeUltrasonicUnoccupiedToOccupiedThresholdID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalContactOccupiedToUnoccupiedDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePhysicalContactOccupiedToUnoccupiedDelayID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePhysicalContactOccupiedToUnoccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePhysicalContactOccupiedToUnoccupiedDelayWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributePhysicalContactOccupiedToUnoccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePhysicalContactOccupiedToUnoccupiedDelayID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalContactUnoccupiedToOccupiedDelayWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePhysicalContactUnoccupiedToOccupiedDelayID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePhysicalContactUnoccupiedToOccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePhysicalContactUnoccupiedToOccupiedDelayWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributePhysicalContactUnoccupiedToOccupiedDelayWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributePhysicalContactUnoccupiedToOccupiedDelayID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhysicalContactUnoccupiedToOccupiedThresholdWithParams: |
| (MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterOccupancySensingAttributePhysicalContactUnoccupiedToOccupiedThresholdID) |
| params:params]; |
| } |
| |
| - (void)writeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterOccupancySensingAttributePhysicalContactUnoccupiedToOccupiedThresholdID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeOccupancySensingID) |
| attributeID:@(MTRAttributeIDTypeClusterOccupancySensingAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterOccupancySensing (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterWakeOnLan |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMACAddressWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWakeOnLanID) |
| attributeID:@(MTRAttributeIDTypeClusterWakeOnLanAttributeMACAddressID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWakeOnLanID) |
| attributeID:@(MTRAttributeIDTypeClusterWakeOnLanAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWakeOnLanID) |
| attributeID:@(MTRAttributeIDTypeClusterWakeOnLanAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWakeOnLanID) |
| attributeID:@(MTRAttributeIDTypeClusterWakeOnLanAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWakeOnLanID) |
| attributeID:@(MTRAttributeIDTypeClusterWakeOnLanAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeWakeOnLanID) |
| attributeID:@(MTRAttributeIDTypeClusterWakeOnLanAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterWakeOnLan (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterChannel |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)changeChannelWithParams:(MTRChannelClusterChangeChannelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRChannelClusterChangeChannelResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRChannelClusterChangeChannelResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ChannelClusterChangeChannelResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Channel::Commands::ChangeChannel::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.match = [self asCharSpan:params.match]; |
| |
| chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)changeChannelByNumberWithParams:(MTRChannelClusterChangeChannelByNumberParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Channel::Commands::ChangeChannelByNumber::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.majorNumber = params.majorNumber.unsignedShortValue; |
| request.minorNumber = params.minorNumber.unsignedShortValue; |
| |
| chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)skipChannelWithParams:(MTRChannelClusterSkipChannelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| Channel::Commands::SkipChannel::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.count = params.count.unsignedShortValue; |
| |
| chip::Controller::ChannelCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeChannelListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeChannelListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLineupWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeLineupID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentChannelWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeCurrentChannelID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeChannelID) |
| attributeID:@(MTRAttributeIDTypeClusterChannelAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterChannel (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)changeChannelWithParams:(MTRChannelClusterChangeChannelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRChannelClusterChangeChannelResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self changeChannelWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRChannelClusterChangeChannelResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRChannelClusterChangeChannelResponseParams *>(data), error); |
| }]; |
| } |
| - (void)changeChannelByNumberWithParams:(MTRChannelClusterChangeChannelByNumberParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self changeChannelByNumberWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)skipChannelWithParams:(MTRChannelClusterSkipChannelParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self skipChannelWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterTargetNavigator |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)navigateTargetWithParams:(MTRTargetNavigatorClusterNavigateTargetParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRTargetNavigatorClusterNavigateTargetResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| TargetNavigatorClusterNavigateTargetResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| TargetNavigator::Commands::NavigateTarget::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.target = params.target.unsignedCharValue; |
| if (params.data != nil) { |
| auto & definedValue_0 = request.data.Emplace(); |
| definedValue_0 = [self asCharSpan:params.data]; |
| } |
| |
| chip::Controller::TargetNavigatorCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTargetListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeTargetListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentTargetWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeCurrentTargetID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeTargetNavigatorID) |
| attributeID:@(MTRAttributeIDTypeClusterTargetNavigatorAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterTargetNavigator (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)navigateTargetWithParams:(MTRTargetNavigatorClusterNavigateTargetParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self navigateTargetWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTargetNavigatorClusterNavigateTargetResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterMediaPlayback |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)playWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self playWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)playWithParams:(MTRMediaPlaybackClusterPlayParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::Play::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)pauseWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self pauseWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)pauseWithParams:(MTRMediaPlaybackClusterPauseParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::Pause::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopPlaybackWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self stopPlaybackWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)stopPlaybackWithParams:(MTRMediaPlaybackClusterStopPlaybackParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::StopPlayback::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)startOverWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self startOverWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)startOverWithParams:(MTRMediaPlaybackClusterStartOverParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::StartOver::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)previousWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self previousWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)previousWithParams:(MTRMediaPlaybackClusterPreviousParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::Previous::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)nextWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self nextWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)nextWithParams:(MTRMediaPlaybackClusterNextParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::Next::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)rewindWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self rewindWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)rewindWithParams:(MTRMediaPlaybackClusterRewindParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::Rewind::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)fastForwardWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self fastForwardWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)fastForwardWithParams:(MTRMediaPlaybackClusterFastForwardParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::FastForward::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)skipForwardWithParams:(MTRMediaPlaybackClusterSkipForwardParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::SkipForward::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.deltaPositionMilliseconds = params.deltaPositionMilliseconds.unsignedLongLongValue; |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)skipBackwardWithParams:(MTRMediaPlaybackClusterSkipBackwardParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::SkipBackward::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.deltaPositionMilliseconds = params.deltaPositionMilliseconds.unsignedLongLongValue; |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)seekWithParams:(MTRMediaPlaybackClusterSeekParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| MediaPlaybackClusterPlaybackResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaPlayback::Commands::Seek::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.position = params.position.unsignedLongLongValue; |
| |
| chip::Controller::MediaPlaybackCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentStateWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeCurrentStateID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStartTimeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeStartTimeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDurationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeDurationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSampledPositionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeSampledPositionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePlaybackSpeedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributePlaybackSpeedID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSeekRangeEndWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeSeekRangeEndID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSeekRangeStartWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeSeekRangeStartID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaPlaybackID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaPlaybackAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterMediaPlayback (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)playWithParams:(MTRMediaPlaybackClusterPlayParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self playWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)playWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self playWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)pauseWithParams:(MTRMediaPlaybackClusterPauseParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self pauseWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)pauseWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self pauseWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)stopPlaybackWithParams:(MTRMediaPlaybackClusterStopPlaybackParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self stopPlaybackWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)stopPlaybackWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self stopPlaybackWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)startOverWithParams:(MTRMediaPlaybackClusterStartOverParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self startOverWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)startOverWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self startOverWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)previousWithParams:(MTRMediaPlaybackClusterPreviousParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self previousWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)previousWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self previousWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)nextWithParams:(MTRMediaPlaybackClusterNextParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self nextWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)nextWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self nextWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)rewindWithParams:(MTRMediaPlaybackClusterRewindParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self rewindWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)rewindWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self rewindWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)fastForwardWithParams:(MTRMediaPlaybackClusterFastForwardParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self fastForwardWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)fastForwardWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self fastForwardWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)skipForwardWithParams:(MTRMediaPlaybackClusterSkipForwardParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self skipForwardWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)skipBackwardWithParams:(MTRMediaPlaybackClusterSkipBackwardParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self skipBackwardWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| - (void)seekWithParams:(MTRMediaPlaybackClusterSeekParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self seekWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRMediaPlaybackClusterPlaybackResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterMediaInput |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)selectInputWithParams:(MTRMediaInputClusterSelectInputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaInput::Commands::SelectInput::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.index = params.index.unsignedCharValue; |
| |
| chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)showInputStatusWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self showInputStatusWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)showInputStatusWithParams:(MTRMediaInputClusterShowInputStatusParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaInput::Commands::ShowInputStatus::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)hideInputStatusWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self hideInputStatusWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)hideInputStatusWithParams:(MTRMediaInputClusterHideInputStatusParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaInput::Commands::HideInputStatus::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)renameInputWithParams:(MTRMediaInputClusterRenameInputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| MediaInput::Commands::RenameInput::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.index = params.index.unsignedCharValue; |
| request.name = [self asCharSpan:params.name]; |
| |
| chip::Controller::MediaInputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInputListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeInputListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentInputWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeCurrentInputID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeMediaInputID) |
| attributeID:@(MTRAttributeIDTypeClusterMediaInputAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterMediaInput (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)selectInputWithParams:(MTRMediaInputClusterSelectInputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self selectInputWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)showInputStatusWithParams:(MTRMediaInputClusterShowInputStatusParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self showInputStatusWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)showInputStatusWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self showInputStatusWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)hideInputStatusWithParams:(MTRMediaInputClusterHideInputStatusParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self hideInputStatusWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)hideInputStatusWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self hideInputStatusWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)renameInputWithParams:(MTRMediaInputClusterRenameInputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self renameInputWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterLowPower |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)sleepWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self sleepWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| LowPower::Commands::Sleep::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::LowPowerCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLowPowerID) |
| attributeID:@(MTRAttributeIDTypeClusterLowPowerAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLowPowerID) |
| attributeID:@(MTRAttributeIDTypeClusterLowPowerAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLowPowerID) |
| attributeID:@(MTRAttributeIDTypeClusterLowPowerAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLowPowerID) |
| attributeID:@(MTRAttributeIDTypeClusterLowPowerAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeLowPowerID) |
| attributeID:@(MTRAttributeIDTypeClusterLowPowerAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterLowPower (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self sleepWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)sleepWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self sleepWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterKeypadInput |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRKeypadInputClusterSendKeyResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| KeypadInputClusterSendKeyResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| KeypadInput::Commands::SendKey::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.keyCode = static_cast<std::remove_reference_t<decltype(request.keyCode)>>(params.keyCode.unsignedCharValue); |
| |
| chip::Controller::KeypadInputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeKeypadInputID) |
| attributeID:@(MTRAttributeIDTypeClusterKeypadInputAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeKeypadInputID) |
| attributeID:@(MTRAttributeIDTypeClusterKeypadInputAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeKeypadInputID) |
| attributeID:@(MTRAttributeIDTypeClusterKeypadInputAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeKeypadInputID) |
| attributeID:@(MTRAttributeIDTypeClusterKeypadInputAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeKeypadInputID) |
| attributeID:@(MTRAttributeIDTypeClusterKeypadInputAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterKeypadInput (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self sendKeyWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRKeypadInputClusterSendKeyResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRKeypadInputClusterSendKeyResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterContentLauncher |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRContentLauncherClusterLaunchResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ContentLauncherClusterLaunchResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ContentLauncher::Commands::LaunchContent::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_1 = std::remove_reference_t<decltype(request.search.parameterList)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.search.parameterList.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.search.parameterList.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.search.parameterList.count; ++i_1) { |
| if (![params.search.parameterList[i_1] isKindOfClass:[MTRContentLauncherClusterParameter class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (MTRContentLauncherClusterParameter *) params.search.parameterList[i_1]; |
| listHolder_1->mList[i_1].type |
| = static_cast<std::remove_reference_t<decltype(listHolder_1->mList[i_1].type)>>( |
| element_1.type.unsignedCharValue); |
| listHolder_1->mList[i_1].value = [self asCharSpan:element_1.value]; |
| if (element_1.externalIDList != nil) { |
| auto & definedValue_3 = listHolder_1->mList[i_1].externalIDList.Emplace(); |
| { |
| using ListType_4 = std::remove_reference_t<decltype(definedValue_3)>; |
| using ListMemberType_4 = ListMemberTypeGetter<ListType_4>::Type; |
| if (element_1.externalIDList.count != 0) { |
| auto * listHolder_4 = new ListHolder<ListMemberType_4>(element_1.externalIDList.count); |
| if (listHolder_4 == nullptr || listHolder_4->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_4); |
| for (size_t i_4 = 0; i_4 < element_1.externalIDList.count; ++i_4) { |
| if (![element_1.externalIDList[i_4] |
| isKindOfClass:[MTRContentLauncherClusterAdditionalInfo class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_4 |
| = (MTRContentLauncherClusterAdditionalInfo *) element_1.externalIDList[i_4]; |
| listHolder_4->mList[i_4].name = [self asCharSpan:element_4.name]; |
| listHolder_4->mList[i_4].value = [self asCharSpan:element_4.value]; |
| } |
| definedValue_3 = ListType_4(listHolder_4->mList, element_1.externalIDList.count); |
| } else { |
| definedValue_3 = ListType_4(); |
| } |
| } |
| } |
| } |
| request.search.parameterList = ListType_1(listHolder_1->mList, params.search.parameterList.count); |
| } else { |
| request.search.parameterList = ListType_1(); |
| } |
| } |
| request.autoPlay = params.autoPlay.boolValue; |
| if (params.data != nil) { |
| auto & definedValue_0 = request.data.Emplace(); |
| definedValue_0 = [self asCharSpan:params.data]; |
| } |
| |
| chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRContentLauncherClusterLaunchResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ContentLauncherClusterLaunchResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ContentLauncher::Commands::LaunchURL::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.contentURL = [self asCharSpan:params.contentURL]; |
| if (params.displayString != nil) { |
| auto & definedValue_0 = request.displayString.Emplace(); |
| definedValue_0 = [self asCharSpan:params.displayString]; |
| } |
| if (params.brandingInformation != nil) { |
| auto & definedValue_0 = request.brandingInformation.Emplace(); |
| definedValue_0.providerName = [self asCharSpan:params.brandingInformation.providerName]; |
| if (params.brandingInformation.background != nil) { |
| auto & definedValue_2 = definedValue_0.background.Emplace(); |
| if (params.brandingInformation.background.imageUrl != nil) { |
| auto & definedValue_4 = definedValue_2.imageUrl.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.background.imageUrl]; |
| } |
| if (params.brandingInformation.background.color != nil) { |
| auto & definedValue_4 = definedValue_2.color.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.background.color]; |
| } |
| if (params.brandingInformation.background.size != nil) { |
| auto & definedValue_4 = definedValue_2.size.Emplace(); |
| definedValue_4.width = params.brandingInformation.background.size.width.doubleValue; |
| definedValue_4.height = params.brandingInformation.background.size.height.doubleValue; |
| definedValue_4.metric = static_cast<std::remove_reference_t<decltype(definedValue_4.metric)>>( |
| params.brandingInformation.background.size.metric.unsignedCharValue); |
| } |
| } |
| if (params.brandingInformation.logo != nil) { |
| auto & definedValue_2 = definedValue_0.logo.Emplace(); |
| if (params.brandingInformation.logo.imageUrl != nil) { |
| auto & definedValue_4 = definedValue_2.imageUrl.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.logo.imageUrl]; |
| } |
| if (params.brandingInformation.logo.color != nil) { |
| auto & definedValue_4 = definedValue_2.color.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.logo.color]; |
| } |
| if (params.brandingInformation.logo.size != nil) { |
| auto & definedValue_4 = definedValue_2.size.Emplace(); |
| definedValue_4.width = params.brandingInformation.logo.size.width.doubleValue; |
| definedValue_4.height = params.brandingInformation.logo.size.height.doubleValue; |
| definedValue_4.metric = static_cast<std::remove_reference_t<decltype(definedValue_4.metric)>>( |
| params.brandingInformation.logo.size.metric.unsignedCharValue); |
| } |
| } |
| if (params.brandingInformation.progressBar != nil) { |
| auto & definedValue_2 = definedValue_0.progressBar.Emplace(); |
| if (params.brandingInformation.progressBar.imageUrl != nil) { |
| auto & definedValue_4 = definedValue_2.imageUrl.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.progressBar.imageUrl]; |
| } |
| if (params.brandingInformation.progressBar.color != nil) { |
| auto & definedValue_4 = definedValue_2.color.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.progressBar.color]; |
| } |
| if (params.brandingInformation.progressBar.size != nil) { |
| auto & definedValue_4 = definedValue_2.size.Emplace(); |
| definedValue_4.width = params.brandingInformation.progressBar.size.width.doubleValue; |
| definedValue_4.height = params.brandingInformation.progressBar.size.height.doubleValue; |
| definedValue_4.metric = static_cast<std::remove_reference_t<decltype(definedValue_4.metric)>>( |
| params.brandingInformation.progressBar.size.metric.unsignedCharValue); |
| } |
| } |
| if (params.brandingInformation.splash != nil) { |
| auto & definedValue_2 = definedValue_0.splash.Emplace(); |
| if (params.brandingInformation.splash.imageUrl != nil) { |
| auto & definedValue_4 = definedValue_2.imageUrl.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.splash.imageUrl]; |
| } |
| if (params.brandingInformation.splash.color != nil) { |
| auto & definedValue_4 = definedValue_2.color.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.splash.color]; |
| } |
| if (params.brandingInformation.splash.size != nil) { |
| auto & definedValue_4 = definedValue_2.size.Emplace(); |
| definedValue_4.width = params.brandingInformation.splash.size.width.doubleValue; |
| definedValue_4.height = params.brandingInformation.splash.size.height.doubleValue; |
| definedValue_4.metric = static_cast<std::remove_reference_t<decltype(definedValue_4.metric)>>( |
| params.brandingInformation.splash.size.metric.unsignedCharValue); |
| } |
| } |
| if (params.brandingInformation.waterMark != nil) { |
| auto & definedValue_2 = definedValue_0.waterMark.Emplace(); |
| if (params.brandingInformation.waterMark.imageUrl != nil) { |
| auto & definedValue_4 = definedValue_2.imageUrl.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.waterMark.imageUrl]; |
| } |
| if (params.brandingInformation.waterMark.color != nil) { |
| auto & definedValue_4 = definedValue_2.color.Emplace(); |
| definedValue_4 = [self asCharSpan:params.brandingInformation.waterMark.color]; |
| } |
| if (params.brandingInformation.waterMark.size != nil) { |
| auto & definedValue_4 = definedValue_2.size.Emplace(); |
| definedValue_4.width = params.brandingInformation.waterMark.size.width.doubleValue; |
| definedValue_4.height = params.brandingInformation.waterMark.size.height.doubleValue; |
| definedValue_4.metric = static_cast<std::remove_reference_t<decltype(definedValue_4.metric)>>( |
| params.brandingInformation.waterMark.size.metric.unsignedCharValue); |
| } |
| } |
| } |
| |
| chip::Controller::ContentLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptHeaderWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeAcceptHeaderID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeSupportedStreamingProtocolsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeSupportedStreamingProtocolsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeSupportedStreamingProtocolsWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeSupportedStreamingProtocolsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeSupportedStreamingProtocolsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeContentLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterContentLauncherAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterContentLauncher (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self launchContentWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRContentLauncherClusterLaunchResponseParams *>(data), error); |
| }]; |
| } |
| - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error))completionHandler |
| { |
| [self launchURLWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRContentLauncherClusterLaunchResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRContentLauncherClusterLaunchResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterAudioOutput |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AudioOutput::Commands::SelectOutput::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.index = params.index.unsignedCharValue; |
| |
| chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AudioOutput::Commands::RenameOutput::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.index = params.index.unsignedCharValue; |
| request.name = [self asCharSpan:params.name]; |
| |
| chip::Controller::AudioOutputCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOutputListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeOutputListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentOutputWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeCurrentOutputID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAudioOutputID) |
| attributeID:@(MTRAttributeIDTypeClusterAudioOutputAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAudioOutput (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self selectOutputWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self renameOutputWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterApplicationLauncher |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRApplicationLauncherClusterLauncherResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ApplicationLauncherClusterLauncherResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ApplicationLauncher::Commands::LaunchApp::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.application.catalogVendorId = params.application.catalogVendorId.unsignedShortValue; |
| request.application.applicationId = [self asCharSpan:params.application.applicationId]; |
| if (params.data != nil) { |
| auto & definedValue_0 = request.data.Emplace(); |
| definedValue_0 = [self asByteSpan:params.data]; |
| } |
| |
| chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRApplicationLauncherClusterLauncherResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ApplicationLauncherClusterLauncherResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ApplicationLauncher::Commands::StopApp::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.application.catalogVendorId = params.application.catalogVendorId.unsignedShortValue; |
| request.application.applicationId = [self asCharSpan:params.application.applicationId]; |
| |
| chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRApplicationLauncherClusterLauncherResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| ApplicationLauncherClusterLauncherResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ApplicationLauncher::Commands::HideApp::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.application.catalogVendorId = params.application.catalogVendorId.unsignedShortValue; |
| request.application.applicationId = [self asCharSpan:params.application.applicationId]; |
| |
| chip::Controller::ApplicationLauncherCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCatalogListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeCatalogListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentAppWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeCurrentAppID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeCurrentAppWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeCurrentAppWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeCurrentAppWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeCurrentAppID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationLauncherID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationLauncherAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterApplicationLauncher (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self launchAppWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRApplicationLauncherClusterLauncherResponseParams *>(data), error); |
| }]; |
| } |
| - (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self stopAppWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRApplicationLauncherClusterLauncherResponseParams *>(data), error); |
| }]; |
| } |
| - (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self hideAppWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRApplicationLauncherClusterLauncherResponseParams *>(data), error); |
| }]; |
| } |
| @end |
| |
| @implementation MTRClusterApplicationBasic |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeVendorNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeVendorIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApplicationNameWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeApplicationNameID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeProductIDWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeProductIDID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApplicationWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeApplicationID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStatusWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeStatusID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApplicationVersionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeApplicationVersionID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAllowedVendorListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeAllowedVendorListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeApplicationBasicID) |
| attributeID:@(MTRAttributeIDTypeClusterApplicationBasicAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterApplicationBasic (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAccountLogin |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRAccountLoginClusterGetSetupPINResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| AccountLoginClusterGetSetupPINResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AccountLogin::Commands::GetSetupPIN::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.tempAccountIdentifier = [self asCharSpan:params.tempAccountIdentifier]; |
| |
| chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AccountLogin::Commands::Login::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| request.tempAccountIdentifier = [self asCharSpan:params.tempAccountIdentifier]; |
| request.setupPIN = [self asCharSpan:params.setupPIN]; |
| |
| chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)logoutWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self logoutWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| AccountLogin::Commands::Logout::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| |
| chip::Controller::AccountLoginCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccountLoginID) |
| attributeID:@(MTRAttributeIDTypeClusterAccountLoginAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccountLoginID) |
| attributeID:@(MTRAttributeIDTypeClusterAccountLoginAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccountLoginID) |
| attributeID:@(MTRAttributeIDTypeClusterAccountLoginAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccountLoginID) |
| attributeID:@(MTRAttributeIDTypeClusterAccountLoginAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeAccountLoginID) |
| attributeID:@(MTRAttributeIDTypeClusterAccountLoginAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterAccountLogin (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self getSetupPINWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRAccountLoginClusterGetSetupPINResponseParams *>(data), error); |
| }]; |
| } |
| - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self loginWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self logoutWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)logoutWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self logoutWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterElectricalMeasurement |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)getProfileInfoCommandWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self getProfileInfoCommandWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)getProfileInfoCommandWithParams:(MTRElectricalMeasurementClusterGetProfileInfoCommandParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ElectricalMeasurement::Commands::GetProfileInfoCommand::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)getMeasurementProfileCommandWithParams:(MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| ElectricalMeasurement::Commands::GetMeasurementProfileCommand::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.attributeId = params.attributeId.unsignedShortValue; |
| request.startTime = params.startTime.unsignedIntValue; |
| request.numberOfIntervals = params.numberOfIntervals.unsignedCharValue; |
| |
| chip::Controller::ElectricalMeasurementCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasurementTypeWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasurementTypeID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcVoltageMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcVoltageMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcVoltageMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcVoltageMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcCurrentMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcCurrentMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcCurrentMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcCurrentMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcPowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcPowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcPowerMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcPowerMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcPowerMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcPowerMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcVoltageMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcVoltageMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcVoltageDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcVoltageDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcCurrentMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcCurrentMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcCurrentDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcCurrentDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcPowerMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcPowerMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeDcPowerDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeDcPowerDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcFrequencyWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcFrequencyID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcFrequencyMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcFrequencyMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcFrequencyMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcFrequencyMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNeutralCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeNeutralCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTotalActivePowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeTotalActivePowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTotalReactivePowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeTotalReactivePowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTotalApparentPowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeTotalApparentPowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasured1stHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasured1stHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasured3rdHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasured3rdHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasured5thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasured5thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasured7thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasured7thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasured9thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasured9thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasured11thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasured11thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredPhase1stHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasuredPhase1stHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredPhase3rdHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasuredPhase3rdHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredPhase5thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasuredPhase5thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredPhase7thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasuredPhase7thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredPhase9thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasuredPhase9thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeMeasuredPhase11thHarmonicCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeMeasuredPhase11thHarmonicCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcFrequencyMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcFrequencyMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcFrequencyDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcFrequencyDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePowerMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributePowerMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePowerDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributePowerDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeHarmonicCurrentMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeHarmonicCurrentMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePhaseHarmonicCurrentMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributePhaseHarmonicCurrentMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstantaneousVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeInstantaneousVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstantaneousLineCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeInstantaneousLineCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstantaneousActiveCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeInstantaneousActiveCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstantaneousReactiveCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeInstantaneousReactiveCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInstantaneousPowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeInstantaneousPowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerMinWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerMinID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerMaxWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerMaxID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReactivePowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeReactivePowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApparentPowerWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeApparentPowerID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePowerFactorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributePowerFactorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsVoltageMeasurementPeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsVoltageMeasurementPeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeAverageRmsVoltageMeasurementPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeAverageRmsVoltageMeasurementPeriodWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeAverageRmsVoltageMeasurementPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsVoltageMeasurementPeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsUnderVoltageCounterWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsUnderVoltageCounterID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeAverageRmsUnderVoltageCounterWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeAverageRmsUnderVoltageCounterWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeAverageRmsUnderVoltageCounterWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsUnderVoltageCounterID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeOverVoltagePeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeOverVoltagePeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRmsExtremeOverVoltagePeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRmsExtremeOverVoltagePeriodWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeRmsExtremeOverVoltagePeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeOverVoltagePeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeUnderVoltagePeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeUnderVoltagePeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRmsExtremeUnderVoltagePeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRmsExtremeUnderVoltagePeriodWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeRmsExtremeUnderVoltagePeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device |
| writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeUnderVoltagePeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSagPeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSagPeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRmsVoltageSagPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRmsVoltageSagPeriodWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeRmsVoltageSagPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSagPeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSwellPeriodWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSwellPeriodID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRmsVoltageSwellPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRmsVoltageSwellPeriodWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeRmsVoltageSwellPeriodWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSwellPeriodID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcVoltageMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcVoltageMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcVoltageDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcVoltageDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcCurrentMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcCurrentMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcCurrentDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcCurrentDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcPowerMultiplierWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcPowerMultiplierID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcPowerDivisorWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcPowerDivisorID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOverloadAlarmsMaskWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeOverloadAlarmsMaskID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOverloadAlarmsMaskWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOverloadAlarmsMaskWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOverloadAlarmsMaskWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeOverloadAlarmsMaskID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVoltageOverloadWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeVoltageOverloadID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCurrentOverloadWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeCurrentOverloadID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcOverloadAlarmsMaskWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcOverloadAlarmsMaskID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeAcOverloadAlarmsMaskWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeAcOverloadAlarmsMaskWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeAcOverloadAlarmsMaskWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcOverloadAlarmsMaskID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcVoltageOverloadWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcVoltageOverloadID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcCurrentOverloadWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcCurrentOverloadID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcActivePowerOverloadWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcActivePowerOverloadID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcReactivePowerOverloadWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcReactivePowerOverloadID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsOverVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsOverVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsUnderVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsUnderVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeOverVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeOverVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeUnderVoltageWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeUnderVoltageID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSagWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSagID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSwellWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSwellID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLineCurrentPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeLineCurrentPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveCurrentPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActiveCurrentPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReactiveCurrentPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeReactiveCurrentPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltagePhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltagePhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageMinPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageMinPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageMaxPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageMaxPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentMinPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentMinPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentMaxPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentMaxPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerMinPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerMinPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerMaxPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerMaxPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReactivePowerPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeReactivePowerPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApparentPowerPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeApparentPowerPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePowerFactorPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributePowerFactorPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsVoltageMeasurementPeriodPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsVoltageMeasurementPeriodPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsOverVoltageCounterPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsOverVoltageCounterPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsUnderVoltageCounterPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsUnderVoltageCounterPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeOverVoltagePeriodPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeOverVoltagePeriodPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeUnderVoltagePeriodPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeUnderVoltagePeriodPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSagPeriodPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSagPeriodPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSwellPeriodPhaseBWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSwellPeriodPhaseBID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLineCurrentPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeLineCurrentPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActiveCurrentPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActiveCurrentPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReactiveCurrentPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeReactiveCurrentPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltagePhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltagePhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageMinPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageMinPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageMaxPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageMaxPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentMinPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentMinPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsCurrentMaxPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsCurrentMaxPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerMinPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerMinPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeActivePowerMaxPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeActivePowerMaxPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeReactivePowerPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeReactivePowerPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeApparentPowerPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeApparentPowerPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributePowerFactorPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributePowerFactorPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsVoltageMeasurementPeriodPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID: |
| @(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsVoltageMeasurementPeriodPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsOverVoltageCounterPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsOverVoltageCounterPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAverageRmsUnderVoltageCounterPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAverageRmsUnderVoltageCounterPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeOverVoltagePeriodPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeOverVoltagePeriodPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsExtremeUnderVoltagePeriodPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsExtremeUnderVoltagePeriodPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSagPeriodPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSagPeriodPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRmsVoltageSwellPeriodPhaseCWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device |
| readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeRmsVoltageSwellPeriodPhaseCID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeElectricalMeasurementID) |
| attributeID:@(MTRAttributeIDTypeClusterElectricalMeasurementAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterElectricalMeasurement (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)getProfileInfoCommandWithParams:(MTRElectricalMeasurementClusterGetProfileInfoCommandParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self getProfileInfoCommandWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)getProfileInfoCommandWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self getProfileInfoCommandWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)getMeasurementProfileCommandWithParams:(MTRElectricalMeasurementClusterGetMeasurementProfileCommandParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self getMeasurementProfileCommandWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| @end |
| |
| @implementation MTRClusterUnitTesting |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue |
| { |
| if (self = [super initWithQueue:queue]) { |
| if (device == nil) { |
| return nil; |
| } |
| |
| _endpoint = [endpointID unsignedShortValue]; |
| _device = device; |
| } |
| return self; |
| } |
| |
| - (void)testWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self testWithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; |
| } |
| - (void)testWithParams:(MTRUnitTestingClusterTestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::Test::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testNotHandledWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self testNotHandledWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)testNotHandledWithParams:(MTRUnitTestingClusterTestNotHandledParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestNotHandled::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testSpecificWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| [self testSpecificWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)testSpecificWithParams:(MTRUnitTestingClusterTestSpecificParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestSpecificResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestSpecificResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestSpecific::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testUnknownCommandWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self testUnknownCommandWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)testUnknownCommandWithParams:(MTRUnitTestingClusterTestUnknownCommandParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestUnknownCommand::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testAddArgumentsWithParams:(MTRUnitTestingClusterTestAddArgumentsParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestAddArgumentsResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestAddArgumentsResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestAddArguments::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1 = params.arg1.unsignedCharValue; |
| request.arg2 = params.arg2.unsignedCharValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testSimpleArgumentRequestWithParams:(MTRUnitTestingClusterTestSimpleArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestSimpleArgumentResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestSimpleArgumentResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestSimpleArgumentResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestSimpleArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1 = params.arg1.boolValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStructArrayArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)(MTRUnitTestingClusterTestStructArrayArgumentResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestStructArrayArgumentResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestStructArrayArgumentResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestStructArrayArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg1)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg1.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg1.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg1.count; ++i_0) { |
| if (![params.arg1[i_0] isKindOfClass:[MTRUnitTestingClusterNestedStructList class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRUnitTestingClusterNestedStructList *) params.arg1[i_0]; |
| listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; |
| listHolder_0->mList[i_0].b = element_0.b.boolValue; |
| listHolder_0->mList[i_0].c.a = element_0.c.a.unsignedCharValue; |
| listHolder_0->mList[i_0].c.b = element_0.c.b.boolValue; |
| listHolder_0->mList[i_0].c.c |
| = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].c.c)>>( |
| element_0.c.c.unsignedCharValue); |
| listHolder_0->mList[i_0].c.d = [self asByteSpan:element_0.c.d]; |
| listHolder_0->mList[i_0].c.e = [self asCharSpan:element_0.c.e]; |
| listHolder_0->mList[i_0].c.f |
| = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].c.f)>>( |
| element_0.c.f.unsignedCharValue); |
| listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; |
| listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].d)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.d.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.d.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.d.count; ++i_2) { |
| if (![element_0.d[i_2] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (MTRUnitTestingClusterSimpleStruct *) element_0.d[i_2]; |
| listHolder_2->mList[i_2].a = element_2.a.unsignedCharValue; |
| listHolder_2->mList[i_2].b = element_2.b.boolValue; |
| listHolder_2->mList[i_2].c |
| = static_cast<std::remove_reference_t<decltype(listHolder_2->mList[i_2].c)>>( |
| element_2.c.unsignedCharValue); |
| listHolder_2->mList[i_2].d = [self asByteSpan:element_2.d]; |
| listHolder_2->mList[i_2].e = [self asCharSpan:element_2.e]; |
| listHolder_2->mList[i_2].f |
| = static_cast<std::remove_reference_t<decltype(listHolder_2->mList[i_2].f)>>( |
| element_2.f.unsignedCharValue); |
| listHolder_2->mList[i_2].g = element_2.g.floatValue; |
| listHolder_2->mList[i_2].h = element_2.h.doubleValue; |
| } |
| listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0.d.count); |
| } else { |
| listHolder_0->mList[i_0].d = ListType_2(); |
| } |
| } |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].e)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.e.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.e.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.e.count; ++i_2) { |
| if (![element_0.e[i_2] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSNumber *) element_0.e[i_2]; |
| listHolder_2->mList[i_2] = element_2.unsignedIntValue; |
| } |
| listHolder_0->mList[i_0].e = ListType_2(listHolder_2->mList, element_0.e.count); |
| } else { |
| listHolder_0->mList[i_0].e = ListType_2(); |
| } |
| } |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].f)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.f.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.f.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.f.count; ++i_2) { |
| if (![element_0.f[i_2] isKindOfClass:[NSData class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSData *) element_0.f[i_2]; |
| listHolder_2->mList[i_2] = [self asByteSpan:element_2]; |
| } |
| listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0.f.count); |
| } else { |
| listHolder_0->mList[i_0].f = ListType_2(); |
| } |
| } |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].g)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.g.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.g.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.g.count; ++i_2) { |
| if (![element_0.g[i_2] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSNumber *) element_0.g[i_2]; |
| listHolder_2->mList[i_2] = element_2.unsignedCharValue; |
| } |
| listHolder_0->mList[i_0].g = ListType_2(listHolder_2->mList, element_0.g.count); |
| } else { |
| listHolder_0->mList[i_0].g = ListType_2(); |
| } |
| } |
| } |
| request.arg1 = ListType_0(listHolder_0->mList, params.arg1.count); |
| } else { |
| request.arg1 = ListType_0(); |
| } |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg2)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg2.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg2.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg2.count; ++i_0) { |
| if (![params.arg2[i_0] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRUnitTestingClusterSimpleStruct *) params.arg2[i_0]; |
| listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; |
| listHolder_0->mList[i_0].b = element_0.b.boolValue; |
| listHolder_0->mList[i_0].c = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].c)>>( |
| element_0.c.unsignedCharValue); |
| listHolder_0->mList[i_0].d = [self asByteSpan:element_0.d]; |
| listHolder_0->mList[i_0].e = [self asCharSpan:element_0.e]; |
| listHolder_0->mList[i_0].f = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].f)>>( |
| element_0.f.unsignedCharValue); |
| listHolder_0->mList[i_0].g = element_0.g.floatValue; |
| listHolder_0->mList[i_0].h = element_0.h.doubleValue; |
| } |
| request.arg2 = ListType_0(listHolder_0->mList, params.arg2.count); |
| } else { |
| request.arg2 = ListType_0(); |
| } |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg3)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg3.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg3.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg3.count; ++i_0) { |
| if (![params.arg3[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.arg3[i_0]; |
| listHolder_0->mList[i_0] = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0])>>( |
| element_0.unsignedCharValue); |
| } |
| request.arg3 = ListType_0(listHolder_0->mList, params.arg3.count); |
| } else { |
| request.arg3 = ListType_0(); |
| } |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg4)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg4.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg4.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg4.count; ++i_0) { |
| if (![params.arg4[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.arg4[i_0]; |
| listHolder_0->mList[i_0] = element_0.boolValue; |
| } |
| request.arg4 = ListType_0(listHolder_0->mList, params.arg4.count); |
| } else { |
| request.arg4 = ListType_0(); |
| } |
| } |
| request.arg5 = static_cast<std::remove_reference_t<decltype(request.arg5)>>(params.arg5.unsignedCharValue); |
| request.arg6 = params.arg6.boolValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testStructArgumentRequestWithParams:(MTRUnitTestingClusterTestStructArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterBooleanResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterBooleanResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestStructArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1.a = params.arg1.a.unsignedCharValue; |
| request.arg1.b = params.arg1.b.boolValue; |
| request.arg1.c = static_cast<std::remove_reference_t<decltype(request.arg1.c)>>(params.arg1.c.unsignedCharValue); |
| request.arg1.d = [self asByteSpan:params.arg1.d]; |
| request.arg1.e = [self asCharSpan:params.arg1.e]; |
| request.arg1.f = static_cast<std::remove_reference_t<decltype(request.arg1.f)>>(params.arg1.f.unsignedCharValue); |
| request.arg1.g = params.arg1.g.floatValue; |
| request.arg1.h = params.arg1.h.doubleValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testNestedStructArgumentRequestWithParams:(MTRUnitTestingClusterTestNestedStructArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterBooleanResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterBooleanResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestNestedStructArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1.a = params.arg1.a.unsignedCharValue; |
| request.arg1.b = params.arg1.b.boolValue; |
| request.arg1.c.a = params.arg1.c.a.unsignedCharValue; |
| request.arg1.c.b = params.arg1.c.b.boolValue; |
| request.arg1.c.c |
| = static_cast<std::remove_reference_t<decltype(request.arg1.c.c)>>(params.arg1.c.c.unsignedCharValue); |
| request.arg1.c.d = [self asByteSpan:params.arg1.c.d]; |
| request.arg1.c.e = [self asCharSpan:params.arg1.c.e]; |
| request.arg1.c.f |
| = static_cast<std::remove_reference_t<decltype(request.arg1.c.f)>>(params.arg1.c.f.unsignedCharValue); |
| request.arg1.c.g = params.arg1.c.g.floatValue; |
| request.arg1.c.h = params.arg1.c.h.doubleValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testListStructArgumentRequestWithParams:(MTRUnitTestingClusterTestListStructArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterBooleanResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterBooleanResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestListStructArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg1)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg1.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg1.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg1.count; ++i_0) { |
| if (![params.arg1[i_0] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRUnitTestingClusterSimpleStruct *) params.arg1[i_0]; |
| listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; |
| listHolder_0->mList[i_0].b = element_0.b.boolValue; |
| listHolder_0->mList[i_0].c = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].c)>>( |
| element_0.c.unsignedCharValue); |
| listHolder_0->mList[i_0].d = [self asByteSpan:element_0.d]; |
| listHolder_0->mList[i_0].e = [self asCharSpan:element_0.e]; |
| listHolder_0->mList[i_0].f = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].f)>>( |
| element_0.f.unsignedCharValue); |
| listHolder_0->mList[i_0].g = element_0.g.floatValue; |
| listHolder_0->mList[i_0].h = element_0.h.doubleValue; |
| } |
| request.arg1 = ListType_0(listHolder_0->mList, params.arg1.count); |
| } else { |
| request.arg1 = ListType_0(); |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testListInt8UArgumentRequestWithParams:(MTRUnitTestingClusterTestListInt8UArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterBooleanResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterBooleanResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestListInt8UArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg1)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg1.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg1.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg1.count; ++i_0) { |
| if (![params.arg1[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.arg1[i_0]; |
| listHolder_0->mList[i_0] = element_0.unsignedCharValue; |
| } |
| request.arg1 = ListType_0(listHolder_0->mList, params.arg1.count); |
| } else { |
| request.arg1 = ListType_0(); |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTestNestedStructListArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterBooleanResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterBooleanResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestNestedStructListArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1.a = params.arg1.a.unsignedCharValue; |
| request.arg1.b = params.arg1.b.boolValue; |
| request.arg1.c.a = params.arg1.c.a.unsignedCharValue; |
| request.arg1.c.b = params.arg1.c.b.boolValue; |
| request.arg1.c.c |
| = static_cast<std::remove_reference_t<decltype(request.arg1.c.c)>>(params.arg1.c.c.unsignedCharValue); |
| request.arg1.c.d = [self asByteSpan:params.arg1.c.d]; |
| request.arg1.c.e = [self asCharSpan:params.arg1.c.e]; |
| request.arg1.c.f |
| = static_cast<std::remove_reference_t<decltype(request.arg1.c.f)>>(params.arg1.c.f.unsignedCharValue); |
| request.arg1.c.g = params.arg1.c.g.floatValue; |
| request.arg1.c.h = params.arg1.c.h.doubleValue; |
| { |
| using ListType_1 = std::remove_reference_t<decltype(request.arg1.d)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.arg1.d.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.arg1.d.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.arg1.d.count; ++i_1) { |
| if (![params.arg1.d[i_1] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (MTRUnitTestingClusterSimpleStruct *) params.arg1.d[i_1]; |
| listHolder_1->mList[i_1].a = element_1.a.unsignedCharValue; |
| listHolder_1->mList[i_1].b = element_1.b.boolValue; |
| listHolder_1->mList[i_1].c = static_cast<std::remove_reference_t<decltype(listHolder_1->mList[i_1].c)>>( |
| element_1.c.unsignedCharValue); |
| listHolder_1->mList[i_1].d = [self asByteSpan:element_1.d]; |
| listHolder_1->mList[i_1].e = [self asCharSpan:element_1.e]; |
| listHolder_1->mList[i_1].f = static_cast<std::remove_reference_t<decltype(listHolder_1->mList[i_1].f)>>( |
| element_1.f.unsignedCharValue); |
| listHolder_1->mList[i_1].g = element_1.g.floatValue; |
| listHolder_1->mList[i_1].h = element_1.h.doubleValue; |
| } |
| request.arg1.d = ListType_1(listHolder_1->mList, params.arg1.d.count); |
| } else { |
| request.arg1.d = ListType_1(); |
| } |
| } |
| { |
| using ListType_1 = std::remove_reference_t<decltype(request.arg1.e)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.arg1.e.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.arg1.e.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.arg1.e.count; ++i_1) { |
| if (![params.arg1.e[i_1] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (NSNumber *) params.arg1.e[i_1]; |
| listHolder_1->mList[i_1] = element_1.unsignedIntValue; |
| } |
| request.arg1.e = ListType_1(listHolder_1->mList, params.arg1.e.count); |
| } else { |
| request.arg1.e = ListType_1(); |
| } |
| } |
| { |
| using ListType_1 = std::remove_reference_t<decltype(request.arg1.f)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.arg1.f.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.arg1.f.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.arg1.f.count; ++i_1) { |
| if (![params.arg1.f[i_1] isKindOfClass:[NSData class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (NSData *) params.arg1.f[i_1]; |
| listHolder_1->mList[i_1] = [self asByteSpan:element_1]; |
| } |
| request.arg1.f = ListType_1(listHolder_1->mList, params.arg1.f.count); |
| } else { |
| request.arg1.f = ListType_1(); |
| } |
| } |
| { |
| using ListType_1 = std::remove_reference_t<decltype(request.arg1.g)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.arg1.g.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.arg1.g.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.arg1.g.count; ++i_1) { |
| if (![params.arg1.g[i_1] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (NSNumber *) params.arg1.g[i_1]; |
| listHolder_1->mList[i_1] = element_1.unsignedCharValue; |
| } |
| request.arg1.g = ListType_1(listHolder_1->mList, params.arg1.g.count); |
| } else { |
| request.arg1.g = ListType_1(); |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testListNestedStructListArgumentRequestWithParams: |
| (MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterBooleanResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterBooleanResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestListNestedStructListArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg1)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg1.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg1.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg1.count; ++i_0) { |
| if (![params.arg1[i_0] isKindOfClass:[MTRUnitTestingClusterNestedStructList class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (MTRUnitTestingClusterNestedStructList *) params.arg1[i_0]; |
| listHolder_0->mList[i_0].a = element_0.a.unsignedCharValue; |
| listHolder_0->mList[i_0].b = element_0.b.boolValue; |
| listHolder_0->mList[i_0].c.a = element_0.c.a.unsignedCharValue; |
| listHolder_0->mList[i_0].c.b = element_0.c.b.boolValue; |
| listHolder_0->mList[i_0].c.c |
| = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].c.c)>>( |
| element_0.c.c.unsignedCharValue); |
| listHolder_0->mList[i_0].c.d = [self asByteSpan:element_0.c.d]; |
| listHolder_0->mList[i_0].c.e = [self asCharSpan:element_0.c.e]; |
| listHolder_0->mList[i_0].c.f |
| = static_cast<std::remove_reference_t<decltype(listHolder_0->mList[i_0].c.f)>>( |
| element_0.c.f.unsignedCharValue); |
| listHolder_0->mList[i_0].c.g = element_0.c.g.floatValue; |
| listHolder_0->mList[i_0].c.h = element_0.c.h.doubleValue; |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].d)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.d.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.d.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.d.count; ++i_2) { |
| if (![element_0.d[i_2] isKindOfClass:[MTRUnitTestingClusterSimpleStruct class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (MTRUnitTestingClusterSimpleStruct *) element_0.d[i_2]; |
| listHolder_2->mList[i_2].a = element_2.a.unsignedCharValue; |
| listHolder_2->mList[i_2].b = element_2.b.boolValue; |
| listHolder_2->mList[i_2].c |
| = static_cast<std::remove_reference_t<decltype(listHolder_2->mList[i_2].c)>>( |
| element_2.c.unsignedCharValue); |
| listHolder_2->mList[i_2].d = [self asByteSpan:element_2.d]; |
| listHolder_2->mList[i_2].e = [self asCharSpan:element_2.e]; |
| listHolder_2->mList[i_2].f |
| = static_cast<std::remove_reference_t<decltype(listHolder_2->mList[i_2].f)>>( |
| element_2.f.unsignedCharValue); |
| listHolder_2->mList[i_2].g = element_2.g.floatValue; |
| listHolder_2->mList[i_2].h = element_2.h.doubleValue; |
| } |
| listHolder_0->mList[i_0].d = ListType_2(listHolder_2->mList, element_0.d.count); |
| } else { |
| listHolder_0->mList[i_0].d = ListType_2(); |
| } |
| } |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].e)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.e.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.e.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.e.count; ++i_2) { |
| if (![element_0.e[i_2] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSNumber *) element_0.e[i_2]; |
| listHolder_2->mList[i_2] = element_2.unsignedIntValue; |
| } |
| listHolder_0->mList[i_0].e = ListType_2(listHolder_2->mList, element_0.e.count); |
| } else { |
| listHolder_0->mList[i_0].e = ListType_2(); |
| } |
| } |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].f)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.f.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.f.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.f.count; ++i_2) { |
| if (![element_0.f[i_2] isKindOfClass:[NSData class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSData *) element_0.f[i_2]; |
| listHolder_2->mList[i_2] = [self asByteSpan:element_2]; |
| } |
| listHolder_0->mList[i_0].f = ListType_2(listHolder_2->mList, element_0.f.count); |
| } else { |
| listHolder_0->mList[i_0].f = ListType_2(); |
| } |
| } |
| { |
| using ListType_2 = std::remove_reference_t<decltype(listHolder_0->mList[i_0].g)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (element_0.g.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(element_0.g.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < element_0.g.count; ++i_2) { |
| if (![element_0.g[i_2] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSNumber *) element_0.g[i_2]; |
| listHolder_2->mList[i_2] = element_2.unsignedCharValue; |
| } |
| listHolder_0->mList[i_0].g = ListType_2(listHolder_2->mList, element_0.g.count); |
| } else { |
| listHolder_0->mList[i_0].g = ListType_2(); |
| } |
| } |
| } |
| request.arg1 = ListType_0(listHolder_0->mList, params.arg1.count); |
| } else { |
| request.arg1 = ListType_0(); |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testListInt8UReverseRequestWithParams:(MTRUnitTestingClusterTestListInt8UReverseRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestListInt8UReverseResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestListInt8UReverseResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestListInt8UReverseResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestListInt8UReverseRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| { |
| using ListType_0 = std::remove_reference_t<decltype(request.arg1)>; |
| using ListMemberType_0 = ListMemberTypeGetter<ListType_0>::Type; |
| if (params.arg1.count != 0) { |
| auto * listHolder_0 = new ListHolder<ListMemberType_0>(params.arg1.count); |
| if (listHolder_0 == nullptr || listHolder_0->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_0); |
| for (size_t i_0 = 0; i_0 < params.arg1.count; ++i_0) { |
| if (![params.arg1[i_0] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_0 = (NSNumber *) params.arg1[i_0]; |
| listHolder_0->mList[i_0] = element_0.unsignedCharValue; |
| } |
| request.arg1 = ListType_0(listHolder_0->mList, params.arg1.count); |
| } else { |
| request.arg1 = ListType_0(); |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testEnumsRequestWithParams:(MTRUnitTestingClusterTestEnumsRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestEnumsResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestEnumsResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestEnumsResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestEnumsRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1 = static_cast<std::remove_reference_t<decltype(request.arg1)>>(params.arg1.unsignedShortValue); |
| request.arg2 = static_cast<std::remove_reference_t<decltype(request.arg2)>>(params.arg2.unsignedCharValue); |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestNullableOptionalRequestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestNullableOptionalResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestNullableOptionalResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestNullableOptionalResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestNullableOptionalRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (params != nil) { |
| if (params.arg1 != nil) { |
| auto & definedValue_0 = request.arg1.Emplace(); |
| if (params.arg1 == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| nonNullValue_1 = params.arg1.unsignedCharValue; |
| } |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestComplexNullableOptionalRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)( |
| MTRUnitTestingClusterTestComplexNullableOptionalResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestComplexNullableOptionalResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestComplexNullableOptionalResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestComplexNullableOptionalRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (params.nullableInt == nil) { |
| request.nullableInt.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.nullableInt.SetNonNull(); |
| nonNullValue_0 = params.nullableInt.unsignedShortValue; |
| } |
| if (params.optionalInt != nil) { |
| auto & definedValue_0 = request.optionalInt.Emplace(); |
| definedValue_0 = params.optionalInt.unsignedShortValue; |
| } |
| if (params.nullableOptionalInt != nil) { |
| auto & definedValue_0 = request.nullableOptionalInt.Emplace(); |
| if (params.nullableOptionalInt == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| nonNullValue_1 = params.nullableOptionalInt.unsignedShortValue; |
| } |
| } |
| if (params.nullableString == nil) { |
| request.nullableString.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.nullableString.SetNonNull(); |
| nonNullValue_0 = [self asCharSpan:params.nullableString]; |
| } |
| if (params.optionalString != nil) { |
| auto & definedValue_0 = request.optionalString.Emplace(); |
| definedValue_0 = [self asCharSpan:params.optionalString]; |
| } |
| if (params.nullableOptionalString != nil) { |
| auto & definedValue_0 = request.nullableOptionalString.Emplace(); |
| if (params.nullableOptionalString == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| nonNullValue_1 = [self asCharSpan:params.nullableOptionalString]; |
| } |
| } |
| if (params.nullableStruct == nil) { |
| request.nullableStruct.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.nullableStruct.SetNonNull(); |
| nonNullValue_0.a = params.nullableStruct.a.unsignedCharValue; |
| nonNullValue_0.b = params.nullableStruct.b.boolValue; |
| nonNullValue_0.c = static_cast<std::remove_reference_t<decltype(nonNullValue_0.c)>>( |
| params.nullableStruct.c.unsignedCharValue); |
| nonNullValue_0.d = [self asByteSpan:params.nullableStruct.d]; |
| nonNullValue_0.e = [self asCharSpan:params.nullableStruct.e]; |
| nonNullValue_0.f = static_cast<std::remove_reference_t<decltype(nonNullValue_0.f)>>( |
| params.nullableStruct.f.unsignedCharValue); |
| nonNullValue_0.g = params.nullableStruct.g.floatValue; |
| nonNullValue_0.h = params.nullableStruct.h.doubleValue; |
| } |
| if (params.optionalStruct != nil) { |
| auto & definedValue_0 = request.optionalStruct.Emplace(); |
| definedValue_0.a = params.optionalStruct.a.unsignedCharValue; |
| definedValue_0.b = params.optionalStruct.b.boolValue; |
| definedValue_0.c = static_cast<std::remove_reference_t<decltype(definedValue_0.c)>>( |
| params.optionalStruct.c.unsignedCharValue); |
| definedValue_0.d = [self asByteSpan:params.optionalStruct.d]; |
| definedValue_0.e = [self asCharSpan:params.optionalStruct.e]; |
| definedValue_0.f = static_cast<std::remove_reference_t<decltype(definedValue_0.f)>>( |
| params.optionalStruct.f.unsignedCharValue); |
| definedValue_0.g = params.optionalStruct.g.floatValue; |
| definedValue_0.h = params.optionalStruct.h.doubleValue; |
| } |
| if (params.nullableOptionalStruct != nil) { |
| auto & definedValue_0 = request.nullableOptionalStruct.Emplace(); |
| if (params.nullableOptionalStruct == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| nonNullValue_1.a = params.nullableOptionalStruct.a.unsignedCharValue; |
| nonNullValue_1.b = params.nullableOptionalStruct.b.boolValue; |
| nonNullValue_1.c = static_cast<std::remove_reference_t<decltype(nonNullValue_1.c)>>( |
| params.nullableOptionalStruct.c.unsignedCharValue); |
| nonNullValue_1.d = [self asByteSpan:params.nullableOptionalStruct.d]; |
| nonNullValue_1.e = [self asCharSpan:params.nullableOptionalStruct.e]; |
| nonNullValue_1.f = static_cast<std::remove_reference_t<decltype(nonNullValue_1.f)>>( |
| params.nullableOptionalStruct.f.unsignedCharValue); |
| nonNullValue_1.g = params.nullableOptionalStruct.g.floatValue; |
| nonNullValue_1.h = params.nullableOptionalStruct.h.doubleValue; |
| } |
| } |
| if (params.nullableList == nil) { |
| request.nullableList.SetNull(); |
| } else { |
| auto & nonNullValue_0 = request.nullableList.SetNonNull(); |
| { |
| using ListType_1 = std::remove_reference_t<decltype(nonNullValue_0)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.nullableList.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.nullableList.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.nullableList.count; ++i_1) { |
| if (![params.nullableList[i_1] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (NSNumber *) params.nullableList[i_1]; |
| listHolder_1->mList[i_1] = static_cast<std::remove_reference_t<decltype(listHolder_1->mList[i_1])>>( |
| element_1.unsignedCharValue); |
| } |
| nonNullValue_0 = ListType_1(listHolder_1->mList, params.nullableList.count); |
| } else { |
| nonNullValue_0 = ListType_1(); |
| } |
| } |
| } |
| if (params.optionalList != nil) { |
| auto & definedValue_0 = request.optionalList.Emplace(); |
| { |
| using ListType_1 = std::remove_reference_t<decltype(definedValue_0)>; |
| using ListMemberType_1 = ListMemberTypeGetter<ListType_1>::Type; |
| if (params.optionalList.count != 0) { |
| auto * listHolder_1 = new ListHolder<ListMemberType_1>(params.optionalList.count); |
| if (listHolder_1 == nullptr || listHolder_1->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_1); |
| for (size_t i_1 = 0; i_1 < params.optionalList.count; ++i_1) { |
| if (![params.optionalList[i_1] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_1 = (NSNumber *) params.optionalList[i_1]; |
| listHolder_1->mList[i_1] = static_cast<std::remove_reference_t<decltype(listHolder_1->mList[i_1])>>( |
| element_1.unsignedCharValue); |
| } |
| definedValue_0 = ListType_1(listHolder_1->mList, params.optionalList.count); |
| } else { |
| definedValue_0 = ListType_1(); |
| } |
| } |
| } |
| if (params.nullableOptionalList != nil) { |
| auto & definedValue_0 = request.nullableOptionalList.Emplace(); |
| if (params.nullableOptionalList == nil) { |
| definedValue_0.SetNull(); |
| } else { |
| auto & nonNullValue_1 = definedValue_0.SetNonNull(); |
| { |
| using ListType_2 = std::remove_reference_t<decltype(nonNullValue_1)>; |
| using ListMemberType_2 = ListMemberTypeGetter<ListType_2>::Type; |
| if (params.nullableOptionalList.count != 0) { |
| auto * listHolder_2 = new ListHolder<ListMemberType_2>(params.nullableOptionalList.count); |
| if (listHolder_2 == nullptr || listHolder_2->mList == nullptr) { |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| listFreer.add(listHolder_2); |
| for (size_t i_2 = 0; i_2 < params.nullableOptionalList.count; ++i_2) { |
| if (![params.nullableOptionalList[i_2] isKindOfClass:[NSNumber class]]) { |
| // Wrong kind of value. |
| return CHIP_ERROR_INVALID_ARGUMENT; |
| } |
| auto element_2 = (NSNumber *) params.nullableOptionalList[i_2]; |
| listHolder_2->mList[i_2] |
| = static_cast<std::remove_reference_t<decltype(listHolder_2->mList[i_2])>>( |
| element_2.unsignedCharValue); |
| } |
| nonNullValue_1 = ListType_2(listHolder_2->mList, params.nullableOptionalList.count); |
| } else { |
| nonNullValue_1 = ListType_2(); |
| } |
| } |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)simpleStructEchoRequestWithParams:(MTRUnitTestingClusterSimpleStructEchoRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterSimpleStructResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterSimpleStructResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterSimpleStructResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::SimpleStructEchoRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1.a = params.arg1.a.unsignedCharValue; |
| request.arg1.b = params.arg1.b.boolValue; |
| request.arg1.c = static_cast<std::remove_reference_t<decltype(request.arg1.c)>>(params.arg1.c.unsignedCharValue); |
| request.arg1.d = [self asByteSpan:params.arg1.d]; |
| request.arg1.e = [self asCharSpan:params.arg1.e]; |
| request.arg1.f = static_cast<std::remove_reference_t<decltype(request.arg1.f)>>(params.arg1.f.unsignedCharValue); |
| request.arg1.g = params.arg1.g.floatValue; |
| request.arg1.h = params.arg1.h.doubleValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)timedInvokeRequestWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| [self timedInvokeRequestWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completion]; |
| } |
| - (void)timedInvokeRequestWithParams:(MTRUnitTestingClusterTimedInvokeRequestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TimedInvokeRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (!timedInvokeTimeoutMs.HasValue()) { |
| timedInvokeTimeoutMs.SetValue(10000); |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testSimpleOptionalArgumentRequestWithParams:(MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(MTRStatusCompletion)completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRCommandSuccessCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, CommandSuccessCallbackType successCb, |
| MTRErrorCallback failureCb, MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| if (params != nil) { |
| if (params.arg1 != nil) { |
| auto & definedValue_0 = request.arg1.Emplace(); |
| definedValue_0 = params.arg1.boolValue; |
| } |
| } |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void)testEmitTestEventRequestWithParams:(MTRUnitTestingClusterTestEmitTestEventRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion:(void (^)(MTRUnitTestingClusterTestEmitTestEventResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestEmitTestEventResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestEmitTestEventResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestEmitTestEventRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1 = params.arg1.unsignedCharValue; |
| request.arg2 = static_cast<std::remove_reference_t<decltype(request.arg2)>>(params.arg2.unsignedCharValue); |
| request.arg3 = params.arg3.boolValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (void) |
| testEmitTestFabricScopedEventRequestWithParams:(MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completion: |
| (void (^)( |
| MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams * _Nullable data, |
| NSError * _Nullable error))completion |
| { |
| // Make a copy of params before we go async. |
| params = [params copy]; |
| NSNumber * timedInvokeTimeoutMsParam = params.timedInvokeTimeoutMs; |
| if (timedInvokeTimeoutMsParam) { |
| timedInvokeTimeoutMsParam = MTRClampedNumber(timedInvokeTimeoutMsParam, @(1), @(UINT16_MAX)); |
| } |
| MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.callbackQueue]; |
| MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { |
| MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID |
| controller:self.device.deviceController]; |
| auto * bridge = new MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseCallbackBridge( |
| self.callbackQueue, |
| ^(id _Nullable value, NSError * _Nullable error) { |
| completion(value, error); |
| [workItem endWork]; |
| }, |
| ^(ExchangeManager & exchangeManager, const SessionHandle & session, |
| UnitTestingClusterTestEmitTestFabricScopedEventResponseCallbackType successCb, MTRErrorCallback failureCb, |
| MTRCallbackBridgeBase * bridge) { |
| chip::Optional<uint16_t> timedInvokeTimeoutMs; |
| ListFreer listFreer; |
| UnitTesting::Commands::TestEmitTestFabricScopedEventRequest::Type request; |
| if (timedInvokeTimeoutMsParam != nil) { |
| timedInvokeTimeoutMs.SetValue(timedInvokeTimeoutMsParam.unsignedShortValue); |
| } |
| request.arg1 = params.arg1.unsignedCharValue; |
| |
| chip::Controller::UnitTestingCluster cppCluster(exchangeManager, session, self->_endpoint); |
| return cppCluster.InvokeCommand(request, bridge, successCb, failureCb, timedInvokeTimeoutMs); |
| }); |
| std::move(*bridge).DispatchAction(baseDevice); |
| }; |
| workItem.readyHandler = readyHandler; |
| [self.device.asyncCallbackWorkQueue enqueueWorkItem:workItem]; |
| |
| if (!expectedValueIntervalMs || ([expectedValueIntervalMs compare:@(0)] == NSOrderedAscending)) { |
| expectedValues = nil; |
| } else { |
| expectedValueIntervalMs = MTRClampedNumber(expectedValueIntervalMs, @(1), @(UINT32_MAX)); |
| } |
| if (expectedValues) { |
| [self.device setExpectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs]; |
| } |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBooleanWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBooleanID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBooleanWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBooleanID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBitmap8WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap8ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBitmap8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBitmap8WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBitmap8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap8ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBitmap16WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap16ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBitmap16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBitmap16WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBitmap16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap16ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBitmap32WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap32ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBitmap32WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBitmap32WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBitmap32WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap32ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeBitmap64WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap64ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeBitmap64WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeBitmap64WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeBitmap64WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeBitmap64ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt8uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt8uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt8uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt8uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt16uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt16uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt16uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt16uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt24uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt24uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt24uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt24uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt24uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt24uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt32uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt32uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt32uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt32uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt32uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt32uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt40uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt40uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt40uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt40uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt40uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt40uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt48uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt48uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt48uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt48uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt48uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt48uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt56uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt56uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt56uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt56uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt56uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt56uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt64uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt64uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt64uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt64uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt64uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt64uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt8sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt8sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt8sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt8sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt16sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt16sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt16sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt16sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt24sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt24sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt24sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt24sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt24sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt24sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt32sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt32sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt32sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt32sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt32sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt32sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt40sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt40sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt40sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt40sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt40sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt40sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt48sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt48sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt48sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt48sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt48sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt48sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt56sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt56sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt56sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt56sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt56sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt56sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeInt64sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt64sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeInt64sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeInt64sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeInt64sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeInt64sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnum8WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEnum8ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnum8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnum8WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeEnum8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEnum8ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnum16WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEnum16ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnum16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnum16WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeEnum16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEnum16ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFloatSingleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeFloatSingleID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeFloatSingleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeFloatSingleWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeFloatSingleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeFloatSingleID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFloatDoubleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeFloatDoubleID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeFloatDoubleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeFloatDoubleWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeFloatDoubleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeFloatDoubleID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeOctetStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeOctetStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeOctetStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeOctetStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeListInt8uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListInt8uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeListInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeListInt8uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeListInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListInt8uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeListOctetStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListOctetStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeListOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeListOctetStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeListOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListOctetStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeListStructOctetStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListStructOctetStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeListStructOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeListStructOctetStringWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeListStructOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListStructOctetStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLongOctetStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeLongOctetStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLongOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLongOctetStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLongOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeLongOctetStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeCharStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeCharStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeCharStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeCharStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeCharStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeCharStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeLongCharStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeLongCharStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeLongCharStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeLongCharStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeLongCharStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeLongCharStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEpochUsWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEpochUsID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEpochUsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEpochUsWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeEpochUsWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEpochUsID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEpochSWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEpochSID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEpochSWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEpochSWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeEpochSWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEpochSID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeVendorIdWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeVendorIdID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeVendorIdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeVendorIdWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeVendorIdWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeVendorIdID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeListNullablesAndOptionalsStructWithParams:(MTRReadParams * _Nullable)params |
| { |
| return |
| [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListNullablesAndOptionalsStructID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeListNullablesAndOptionalsStructWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeListNullablesAndOptionalsStructWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListNullablesAndOptionalsStructID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeEnumAttrWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEnumAttrID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeEnumAttrWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeEnumAttrWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeEnumAttrWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeEnumAttrID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeStructAttrWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeStructAttrID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeStructAttrWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeStructAttrWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeStructAttrWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeStructAttrID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRangeRestrictedInt8uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt8uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRangeRestrictedInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRangeRestrictedInt8uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeRangeRestrictedInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt8uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRangeRestrictedInt8sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt8sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRangeRestrictedInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRangeRestrictedInt8sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeRangeRestrictedInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt8sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRangeRestrictedInt16uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt16uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRangeRestrictedInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRangeRestrictedInt16uWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeRangeRestrictedInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt16uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeRangeRestrictedInt16sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt16sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeRangeRestrictedInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeRangeRestrictedInt16sWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeRangeRestrictedInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeRangeRestrictedInt16sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeListLongOctetStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListLongOctetStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeListLongOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeListLongOctetStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeListLongOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListLongOctetStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeListFabricScopedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListFabricScopedID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeListFabricScopedWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeListFabricScopedWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeListFabricScopedWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeListFabricScopedID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeTimedWriteBooleanWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeTimedWriteBooleanID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeTimedWriteBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeTimedWriteBooleanWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeTimedWriteBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeTimedWriteBooleanID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneralErrorBooleanWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGeneralErrorBooleanID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeGeneralErrorBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeGeneralErrorBooleanWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeGeneralErrorBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGeneralErrorBooleanID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterErrorBooleanWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeClusterErrorBooleanID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeClusterErrorBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeClusterErrorBooleanWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeClusterErrorBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeClusterErrorBooleanID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeUnsupportedWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeUnsupportedID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeUnsupportedWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeUnsupportedWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeUnsupportedWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeUnsupportedID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableBooleanWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBooleanID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableBooleanWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableBooleanWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBooleanID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableBitmap8WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap8ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableBitmap8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableBitmap8WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableBitmap8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap8ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableBitmap16WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap16ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableBitmap16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableBitmap16WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableBitmap16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap16ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableBitmap32WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap32ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableBitmap32WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableBitmap32WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableBitmap32WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap32ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableBitmap64WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap64ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableBitmap64WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableBitmap64WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableBitmap64WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableBitmap64ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt8uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt8uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt8uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt8uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt16uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt16uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt16uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt16uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt24uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt24uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt24uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt24uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt24uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt24uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt32uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt32uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt32uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt32uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt32uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt32uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt40uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt40uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt40uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt40uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt40uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt40uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt48uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt48uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt48uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt48uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt48uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt48uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt56uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt56uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt56uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt56uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt56uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt56uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt64uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt64uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt64uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt64uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt64uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt64uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt8sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt8sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt8sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt8sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt16sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt16sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt16sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt16sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt24sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt24sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt24sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt24sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt24sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt24sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt32sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt32sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt32sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt32sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt32sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt32sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt40sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt40sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt40sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt40sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt40sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt40sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt48sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt48sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt48sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt48sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt48sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt48sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt56sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt56sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt56sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt56sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt56sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt56sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableInt64sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt64sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableInt64sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableInt64sWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableInt64sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableInt64sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableEnum8WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableEnum8ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableEnum8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableEnum8WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableEnum8WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableEnum8ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableEnum16WithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableEnum16ID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableEnum16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableEnum16WithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableEnum16WithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableEnum16ID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableFloatSingleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableFloatSingleID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableFloatSingleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableFloatSingleWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableFloatSingleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableFloatSingleID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableFloatDoubleWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableFloatDoubleID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableFloatDoubleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableFloatDoubleWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableFloatDoubleWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableFloatDoubleID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableOctetStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableOctetStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableOctetStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableOctetStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableOctetStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableCharStringWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableCharStringID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableCharStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableCharStringWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableCharStringWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableCharStringID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableEnumAttrWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableEnumAttrID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableEnumAttrWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableEnumAttrWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableEnumAttrWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableEnumAttrID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableStructWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableStructID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableStructWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableStructWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeNullableStructWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableStructID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableRangeRestrictedInt8uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt8uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableRangeRestrictedInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableRangeRestrictedInt8uWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeNullableRangeRestrictedInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt8uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableRangeRestrictedInt8sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt8sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableRangeRestrictedInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableRangeRestrictedInt8sWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeNullableRangeRestrictedInt8sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt8sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableRangeRestrictedInt16uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt16uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableRangeRestrictedInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableRangeRestrictedInt16uWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeNullableRangeRestrictedInt16uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt16uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeNullableRangeRestrictedInt16sWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt16sID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeNullableRangeRestrictedInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeNullableRangeRestrictedInt16sWithValue:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| params:nil]; |
| } |
| - (void)writeAttributeNullableRangeRestrictedInt16sWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeNullableRangeRestrictedInt16sID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeWriteOnlyInt8uWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeWriteOnlyInt8uID) |
| params:params]; |
| } |
| |
| - (void)writeAttributeWriteOnlyInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| { |
| [self writeAttributeWriteOnlyInt8uWithValue:dataValueDictionary expectedValueInterval:expectedValueIntervalMs params:nil]; |
| } |
| - (void)writeAttributeWriteOnlyInt8uWithValue:(NSDictionary<NSString *, id> *)dataValueDictionary |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| params:(MTRWriteParams * _Nullable)params |
| { |
| NSNumber * timedWriteTimeout = params.timedWriteTimeout; |
| |
| [self.device writeAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeWriteOnlyInt8uID) |
| value:dataValueDictionary |
| expectedValueInterval:expectedValueIntervalMs |
| timedWriteTimeout:timedWriteTimeout]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeGeneratedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeAcceptedCommandListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeAttributeListID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeFeatureMapID) |
| params:params]; |
| } |
| |
| - (NSDictionary<NSString *, id> *)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params |
| { |
| return [self.device readAttributeWithEndpointID:@(_endpoint) |
| clusterID:@(MTRClusterIDTypeUnitTestingID) |
| attributeID:@(MTRAttributeIDTypeClusterUnitTestingAttributeClusterRevisionID) |
| params:params]; |
| } |
| |
| @end |
| |
| @implementation MTRClusterTestCluster |
| @end |
| |
| @implementation MTRClusterTestCluster (Deprecated) |
| |
| - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(uint16_t)endpoint queue:(dispatch_queue_t)queue |
| { |
| return [self initWithDevice:device endpointID:@(endpoint) queue:queue]; |
| } |
| |
| - (void)testWithParams:(MTRTestClusterClusterTestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)testWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)testNotHandledWithParams:(MTRTestClusterClusterTestNotHandledParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testNotHandledWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)testNotHandledWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testNotHandledWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)testSpecificWithParams:(MTRTestClusterClusterTestSpecificParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestSpecificResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testSpecificWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterTestSpecificResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testSpecificWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestSpecificResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testSpecificWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)testUnknownCommandWithParams:(MTRTestClusterClusterTestUnknownCommandParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testUnknownCommandWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)testUnknownCommandWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testUnknownCommandWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)testAddArgumentsWithParams:(MTRTestClusterClusterTestAddArgumentsParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestAddArgumentsResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testAddArgumentsWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterTestAddArgumentsResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testSimpleArgumentRequestWithParams:(MTRTestClusterClusterTestSimpleArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestSimpleArgumentResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testSimpleArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestSimpleArgumentResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestSimpleArgumentResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testStructArrayArgumentRequestWithParams:(MTRTestClusterClusterTestStructArrayArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRTestClusterClusterTestStructArrayArgumentResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testStructArrayArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestStructArrayArgumentResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestStructArrayArgumentResponseParams *>(data), |
| error); |
| }]; |
| } |
| - (void)testStructArgumentRequestWithParams:(MTRTestClusterClusterTestStructArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testStructArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterBooleanResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testNestedStructArgumentRequestWithParams:(MTRTestClusterClusterTestNestedStructArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testNestedStructArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterBooleanResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testListStructArgumentRequestWithParams:(MTRTestClusterClusterTestListStructArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| testListStructArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterBooleanResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testListInt8UArgumentRequestWithParams:(MTRTestClusterClusterTestListInt8UArgumentRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testListInt8UArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterBooleanResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterBooleanResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testNestedStructListArgumentRequestWithParams:(MTRTestClusterClusterTestNestedStructListArgumentRequestParams *)params |
| expectedValues: |
| (NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testNestedStructListArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterBooleanResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testListNestedStructListArgumentRequestWithParams: |
| (MTRTestClusterClusterTestListNestedStructListArgumentRequestParams *)params |
| expectedValues: |
| (NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testListNestedStructListArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterBooleanResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterBooleanResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testListInt8UReverseRequestWithParams:(MTRTestClusterClusterTestListInt8UReverseRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestListInt8UReverseResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testListInt8UReverseRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestListInt8UReverseResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestListInt8UReverseResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testEnumsRequestWithParams:(MTRTestClusterClusterTestEnumsRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestEnumsResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testEnumsRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestEnumsResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterTestEnumsResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testNullableOptionalRequestWithParams:(MTRTestClusterClusterTestNullableOptionalRequestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestNullableOptionalResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testNullableOptionalRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestNullableOptionalResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestNullableOptionalResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testComplexNullableOptionalRequestWithParams:(MTRTestClusterClusterTestComplexNullableOptionalRequestParams *)params |
| expectedValues: |
| (NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)(MTRTestClusterClusterTestComplexNullableOptionalResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testComplexNullableOptionalRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterTestComplexNullableOptionalResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestComplexNullableOptionalResponseParams *>( |
| data), |
| error); |
| }]; |
| } |
| - (void)simpleStructEchoRequestWithParams:(MTRTestClusterClusterSimpleStructEchoRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterSimpleStructResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self simpleStructEchoRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterSimpleStructResponseParams * _Nullable data, NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler(static_cast<MTRTestClusterClusterSimpleStructResponseParams *>(data), error); |
| }]; |
| } |
| - (void)timedInvokeRequestWithParams:(MTRTestClusterClusterTimedInvokeRequestParams * _Nullable)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self timedInvokeRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)timedInvokeRequestWithExpectedValues:(NSArray<NSDictionary<NSString *, id> *> *)expectedValues |
| expectedValueInterval:(NSNumber *)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self timedInvokeRequestWithParams:nil |
| expectedValues:expectedValues |
| expectedValueInterval:expectedValueIntervalMs |
| completionHandler:completionHandler]; |
| } |
| - (void)testSimpleOptionalArgumentRequestWithParams:(MTRTestClusterClusterTestSimpleOptionalArgumentRequestParams * _Nullable)params |
| expectedValues: |
| (NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(MTRStatusCompletion)completionHandler |
| { |
| [self testSimpleOptionalArgumentRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:completionHandler]; |
| } |
| - (void)testEmitTestEventRequestWithParams:(MTRTestClusterClusterTestEmitTestEventRequestParams *)params |
| expectedValues:(NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler:(void (^)(MTRTestClusterClusterTestEmitTestEventResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self testEmitTestEventRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^(MTRUnitTestingClusterTestEmitTestEventResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestEmitTestEventResponseParams *>(data), error); |
| }]; |
| } |
| - (void)testEmitTestFabricScopedEventRequestWithParams:(MTRTestClusterClusterTestEmitTestFabricScopedEventRequestParams *)params |
| expectedValues: |
| (NSArray<NSDictionary<NSString *, id> *> * _Nullable)expectedDataValueDictionaries |
| expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs |
| completionHandler: |
| (void (^)( |
| MTRTestClusterClusterTestEmitTestFabricScopedEventResponseParams * _Nullable data, |
| NSError * _Nullable error))completionHandler |
| { |
| [self |
| testEmitTestFabricScopedEventRequestWithParams:params |
| expectedValues:expectedDataValueDictionaries |
| expectedValueInterval:expectedValueIntervalMs |
| completion:^( |
| MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams * _Nullable data, |
| NSError * _Nullable error) { |
| // Cast is safe because subclass does not add any selectors. |
| completionHandler( |
| static_cast<MTRTestClusterClusterTestEmitTestFabricScopedEventResponseParams *>( |
| data), |
| error); |
| }]; |
| } |
| @end |
| |
| // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks) |